Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 SQL Proc?

Author  Topic 

anwarul.haque
Starting Member

7 Posts

Posted - 2008-11-24 : 00:39:48
How to get these details fieldname, field type, field size, and maximum width of the values in the field from either SQL Proc or query,


Thanks in Adv

Haque

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-24 : 00:41:54
[code]SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME ='Your Table name here'[/code]
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-24 : 00:42:17
or just use

sp_help tablename
Go to Top of Page

anwarul.haque
Starting Member

7 Posts

Posted - 2008-11-24 : 02:14:43
Thanks for quick response!
I have this one
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
to get the out put now.
But I need to take one by one field detail and store in Temp tables
is it possible?
Thanks again



quote:
Originally posted by visakh16

SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME ='Your Table name here'




Haque
Go to Top of Page

anwarul.haque
Starting Member

7 Posts

Posted - 2008-11-24 : 02:16:08
Thanks visakh!

quote:
Originally posted by visakh16

or just use

sp_help tablename




Haque
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-24 : 02:41:01
Welcome
Go to Top of Page
   

- Advertisement -