Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retreive table structure

Status
Not open for further replies.

zancraft

Programmer
Joined
Sep 18, 2005
Messages
1
Location
US
Hi, I need to retreive the detailed structure for a given table (field_name, type, length and isnull ?).

I have this query that gives me the columns names:

select Column_name = isnull(c.name, 'NULL'),
Type = isnull(convert(char(30), x.xtname),
isnull(convert(char(30),
get_xtypename(c.xtype, c.xdbid)),t.name))
from syscolumns c, systypes t, sysxtypes x
where c.id = object_id('table_name')
and c.usertype *= t.usertype
and c.xtype *= x.xtid

I tried with the systypes.coltype but doesnt work as I want.
Please anyone can help me with this issue ?

thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top