Wednesday, March 7, 2012

Quick Dumb Question

Quick Dumb Question
I was wondering if there was a way to revel what format a query returns
per column.
I am running into the situation where I am pulling data from a huge
list, and occasionally I get the error "Implicit conversion from data
type sql_variant to varchar is not allowed. Use the CONVERT function to
run this query." When inserting it into a table. When I run the
command without the insert it return all the information without the
error. So now I need to go hunt what column has the incorrect format
and what format to change it to or need to run CONVERT on that
particular item in the query
Hope that made sense.SELECT COLUMN_NAME, DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'Your Table'
Should give you a listing of the columns in a table, and their datatypes.
"Matthew" wrote:

> Quick Dumb Question
> I was wondering if there was a way to revel what format a query returns
> per column.
> I am running into the situation where I am pulling data from a huge
> list, and occasionally I get the error "Implicit conversion from data
> type sql_variant to varchar is not allowed. Use the CONVERT function to
> run this query." When inserting it into a table. When I run the
> command without the insert it return all the information without the
> error. So now I need to go hunt what column has the incorrect format
> and what format to change it to or need to run CONVERT on that
> particular item in the query
> Hope that made sense.
>

No comments:

Post a Comment