November 24, 2008 at 12:06 am
Hi All,
I need to use sql script.
How to get a table fieldname, field type, field size, and maximum width of the values in the field that currently stored. And same time store in temp table of returned out put of the SQL script.
I have a Query that returning tables fields details.
-------------------
SELECT obj.name Table_Name, sycol.name Column_Name,Len(sycol.name) 'Data Length', t.name DataType, sycol.Length
FROM sysobjects obj
INNER JOIN syscolumns sycol ON (obj.id=sycol.id and obj.type='U' and obj.name not like 'dt%')
Inner Join systypes t ON (sycol.xtype=t.xtype)
order by obj.name, sycol.name
-----------------------------------
have an idea any body
Thanks in Advance
Haque A
November 24, 2008 at 12:16 am
If that SELECT is returning the values you want, then...
SELECT obj.name Table_Name, sycol.name Column_Name,Len(sycol.name) 'Data Length', t.name DataType, sycol.Length
INTO #yourtemptable
FROM sysobjects obj
INNER JOIN syscolumns sycol ON (obj.id=sycol.id and obj.type='U' and obj.name not like 'dt%')
Inner Join systypes t ON (sycol.xtype=t.xtype)
order by obj.name, sycol.name
SELECT collist FROM #yourtemptable
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply