October 20, 2008 at 5:15 pm
Can someone help me find the data types for all the user tables in the master database? I know I can find the user tables in the sys.tables but where can I find the data types for those tables? I want to create an excel sheet with tables and their data types, any help is much appreciated.
October 20, 2008 at 6:14 pm
Did you check syscolumns table?
October 20, 2008 at 6:26 pm
Yes. I can see the max_length, but not data_types? Any suggestions?
October 20, 2008 at 8:01 pm
the recommended way is to use the system views like this:
select * from INFORMATION_SCHEMA.COLUMNS
if you want to start doing it yourself, this will get you started:
select object_name(id) as TableName,
name as ColumnName,
type_name(xtype)
from syscolumns
Lowell
October 20, 2008 at 8:07 pm
tjm (10/20/2008)
Yes. I can see the max_length, but not data_types? Any suggestions?
SELECT * FROM Information_Schema.Columns
--Jeff Moden
Change is inevitable... Change for the better is not.
October 21, 2008 at 8:37 am
That was the table I was looking for. Thanks for all your help...
October 21, 2008 at 6:42 pm
You're welcome and thanks for the feedback. Just to be clear, it's a view... not a table. 🙂
--Jeff Moden
Change is inevitable... Change for the better is not.
October 21, 2008 at 7:06 pm
I use sp_help table_name
gives me all details of tables, including column names and their data types and data lengths ( if any ).
Thanks
Imran Mohammed.
October 22, 2008 at 6:15 am
Information is great from all of you. Thanks again for reaching out!
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply