Saturday, February 25, 2012

ACCESS SQL COLUMN DATA TYPE

HELLO

i have an sql server database, with a table an some columns.

how can i get the data type of each column and the lengh define in the database table?

Are you working with SQL Server 2000 or 2005?

|||

sql 2000

|||

Fire up profiler, filter to your spid, and run sp_help on a table. See what SQL Server does. You can copy the code from what SQL Server does and use it for yourself. To start with, check out syscolumns in books online.

|||

Or, you could use the INFORMATION_SCHEMA views to do it:

SELECT *FROM INFORMATION_SCHEMA.columnsWHERE table_Name =table  

HTH,

Stu

No comments:

Post a Comment