Name and Data Type of all columns
-
Hello All, I have a SQL 200 DB in place, but now I want to run a script or SP that will give me as an output the name and data type of all the columns in one of the tables. Any Ideas? Thanks in Advance.
-
Hello All, I have a SQL 200 DB in place, but now I want to run a script or SP that will give me as an output the name and data type of all the columns in one of the tables. Any Ideas? Thanks in Advance.
SELECT
COLUMN_NAME,
DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'whimsy'
ORDER BY ORDINAL_POSITIONRegards, Jeff Varszegi EEEP! An Extensible Expression Evaluation Package
-
SELECT
COLUMN_NAME,
DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'whimsy'
ORDER BY ORDINAL_POSITIONRegards, Jeff Varszegi EEEP! An Extensible Expression Evaluation Package
Thank you..
-
Thank you..
You're welcome! I assume you have access to Query Analyzer, yes? You could spend a fun couple of hours just poking around in 1) the master.dbo tables, where lots of useful information is stored; 2) INFORMATION_SCHEMA views, which Microsoft recommends whenever possible; 3) the other databases like msdb, where job and replication info is stored etc. etc. Also look up system functions and sp_ stored procedures in books online. After all that, you'll have the beginnings of the beginnings of a good working knowledge of SQL Server. And get your boss to spring for the Microsoft Press books on SQL Server; they're really good. Regards, Jeff Varszegi EEEP! An Extensible Expression Evaluation Package