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 |
stumbling
Posting Yak Master
104 Posts |
Posted - 2009-07-13 : 22:30:55
|
Hi there i have the following code sorted but i need to run this accross all databses on the server and i need to output it to the one file.select distinct table_catalog,table_name,column_name from information_schema.columns order by table_catalog,table_nameIs there a way I can i make this search all databases on the server?CheersPhil |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-07-13 : 22:47:25
|
[code]create table #temp( TABLE_CATALOG sysname, TABLE_NAME sysname, COLUMN_NAME sysname,)insert into #tempexec dbo.sp_MSforeachdb 'use ?;select TABLE_CATALOG, TABLE_NAME, COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS'SELECT TABLE_CATALOG, TABLE_NAME, COLUMN_NAMEFROM #temp[/code] KH[spoiler]Time is always against us[/spoiler] |
|
|
stumbling
Posting Yak Master
104 Posts |
Posted - 2009-07-13 : 23:39:21
|
Thank you very much for that.quote: Originally posted by khtan
create table #temp( TABLE_CATALOG sysname, TABLE_NAME sysname, COLUMN_NAME sysname,)insert into #tempexec dbo.sp_MSforeachdb 'use ?;select TABLE_CATALOG, TABLE_NAME, COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS'SELECT TABLE_CATALOG, TABLE_NAME, COLUMN_NAMEFROM #temp KH[spoiler]Time is always against us[/spoiler]
|
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|
|