|
|
Question : How do I find DataType from syscolumns?
|
|
I am using this query to call the Column name from a table. What I would like also to do is call the DataType. How can I do that?
select c.name, c.type from syscolumns c join sysobjects o on c.id = o.id where o.name = 'tblMember' order by c.name desc
Thanks
|
Answer : How do I find DataType from syscolumns?
|
|
The datatype code is in the "xtype" column.
To see the corresponding name of that type, do this:
select c.name, c.type, t.name AS [Data Type] from syscolumns c join systypes t ON t.xtype = c.xtype where OBJECT_NAME(c.id) = N'tblMember' order by c.name desc
|
|
|
|
|