Monday, March 19, 2012

COl_NAME

Hi there

I'm trying to make some dynamic updated documentation for a MS SQL database, in flash.

So I want to make an SQL which gives the same output as when you look at "Design Table" (Column names, Data type, Lenght, Allow Nulls)

I know how to make a Query for a specific column (COL_NAME) but how do I make a QUERY for all the Columns in a table?

All help is appreciated!!!

Thanks

OISexec sp_columns TableName
may fetch u required result set.

Originally posted by OIS
Hi there

I'm trying to make some dynamic updated documentation for a MS SQL database, in flash.

So I want to make an SQL which gives the same output as when you look at "Design Table" (Column names, Data type, Lenght, Allow Nulls)

I know how to make a Query for a specific column (COL_NAME) but how do I make a QUERY for all the Columns in a table?

All help is appreciated!!!

Thanks

OIS|||This info is stored in sys tables and can be retrieved through the INFORMATION_SCHEMA.Columns view.

select *
from Information_Schema.Columns where Table_Name = #yourtable#

You may also need to specify a TABLE_CATALOG and TABLE_SCHEMA and keep in mind that the information for different data types is stored in different columns of the view.|||Exec sp_Columns is precisly what I was looking for.

Thanks for the help!!!!!

No comments:

Post a Comment