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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display Table Details 2

Status
Not open for further replies.

clayton74

Technical User
Apr 17, 2002
187
GB
Hello
I was wondering if therre is a SQL command to view the details of a table, column name, data type, length, allow nulls. I use to have code but I have mislaid it. Any help would be grateful
 
Select * From Information_Schema.Columns Where Table_Name = '[!]YourTableNameHere[/!]'

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
One way

Code:
select table_name,column_name,data_type,coalesce(column_default,'') as column_default,is_nullable,
CHARACTER_MAXIMUM_LENGTH,
NUMERIC_PRECISION, 
NUMERIC_PRECISION_RADIX ,
NUMERIC_SCALE
 from INFORMATION_SCHEMA.COLUMNS 
where table_name = 'YourTableName'
[code]

Denis The SQL Menace 
SQL blog:[URL unfurl="true"]http://sqlservercode.blogspot.com/[/URL] 

Personal Blog:[URL unfurl="true"]http://otherthingsnow.blogspot.com/[/URL]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top