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.
| Author |
Topic |
|
madhan
Yak Posting Veteran
59 Posts |
Posted - 2011-12-24 : 08:04:34
|
| Hi, Sorry for the very newbie question. I have tried googling about this question but no luck. how to find out table column description(datatype, column name etc) by code without using table designer. Thanks. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-24 : 08:06:29
|
| [code]SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME ='Your Table Name here'[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
madhan
Yak Posting Veteran
59 Posts |
Posted - 2011-12-24 : 08:07:48
|
| Thanks! That was very quick response!! |
 |
|
|
madhan
Yak Posting Veteran
59 Posts |
Posted - 2011-12-24 : 08:35:00
|
select * from tempdb.INFORMATION_SCHEMA.TABLES the previous query displayed all info.butuse AdventureWorks2008; GO select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='Person.Person' I got only empty Information_schema information. But table designer displayed table column and data type. please help me again. |
 |
|
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2011-12-24 : 08:56:51
|
| Query sys.tables and sys.columns, you may also need sys.types.Or, in your query, filter for Table_Name='Person'The table is not named Person.Person. It's the table called Person in the schema called Person.--Gail ShawSQL Server MVP |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-24 : 09:22:24
|
quote: Originally posted by madhan select * from tempdb.INFORMATION_SCHEMA.TABLES the previous query displayed all info.butuse AdventureWorks2008; GO select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='Person.Person' I got only empty Information_schema information. But table designer displayed table column and data type. please help me again.
it should be use AdventureWorks2008; GO select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='Person' AND TABLE_SCHEMA = 'Person' ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-12-27 : 08:10:20
|
| orEXEC sp_help 'table name'MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|