Skip to main content
Participant
June 6, 2013
Question

INFORMATION_SCHEMA.Columns

  • June 6, 2013
  • 1 reply
  • 566 views

i have the following query that worked just fine on CF7 and SQL server 2000

<cfquery name="getColumns" datasource="ds">

SELECT Column_Name, Data_Type

FROM INFORMATION_SCHEMA.Columns

WHERE Table_Name = 'Fields'

AND Table_Catalog = 'databasename'

</cfquery>

now that have upgraded to CF 9 and SQL 2012 - this query does not work

"

Error Executing Database Query.

[Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near the keyword 'FROM'.

Any ideas - trying to export from SQL database to an excel file - THANKS!

This topic has been closed for replies.

1 reply

Inspiring
June 11, 2013

What happens if you change the query to SELECT * FROM COLUMNS ...  ???  If that works then you might need to put brackets around those column names.  They don't look exactly like SQL reserved words, but ...

-reed