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 |
jscot
Posting Yak Master
106 Posts |
Posted - 2010-11-22 : 22:31:10
|
Hi guys, I have one database with 48 tables and i am not sure how many total columns. My question is is there any way i can copy all columns with data type so i can paste in excel or text. I am creating mapping document i have to type all tables with columns. I just want to know is there any way i can save my typing ):. Thanks in advance. |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-11-22 : 23:01:38
|
[code]SELECT t.table_name, c.column_name, c.data_type, c.numeric_precision, c.numeric_scaleFROM INFORMATION_SCHEMA.TABLES tJOIN INFORMATION_SCHEMA.COLUMNS cOn c.table_name = t.table_nameORDER BY t.table_name, c.ordinal_position[/code] |
 |
|
jscot
Posting Yak Master
106 Posts |
Posted - 2010-11-22 : 23:17:07
|
Russell Thanks for prompt reply! quick question, After i run this query i can get column name and data type but how i can copy those column name and data type from SSMS ? |
 |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-11-22 : 23:21:03
|
just click the result set, then ctrl-a, ctrl-c and paste it to excel.if you need to automate it, use BCP or SSIS. |
 |
|
jscot
Posting Yak Master
106 Posts |
Posted - 2010-11-23 : 23:04:43
|
Sorry for late reply! you solve my problem, Thanks you. Your time, help us a lot. Please keep it up! |
 |
|
|
|
|