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
 General SQL Server Forums
 New to SQL Server Programming
 Adding table on all dbs on current server

Author  Topic 

SQLCode
Posting Yak Master

143 Posts

Posted - 2008-08-14 : 09:21:49
Hi
I was wondering if there is a way to add a sample table on all databases of current server for SQL 2005

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-08-14 : 09:24:43
you mean create a table in all database ?

just run the create table script in each database one by one. Or are you looking for a solution to do this automatically for all database ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-08-14 : 09:53:30
install the SsmsToolsPack from my signature and use the "Run on multiple targets" feature

_______________________________________________
Causing trouble since 1980
Blog: http://weblogs.sqlteam.com/mladenp
Speed up SSMS development: www.ssmstoolspack.com <- version 1.0 out!
Go to Top of Page

SQLCode
Posting Yak Master

143 Posts

Posted - 2008-08-14 : 09:58:10
yes, looking for a solution to do this automatically for all databases
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-08-14 : 10:11:56
A good thing I don't charge royalties for that, Spirit1

The tool is the better way to to this, in favor of this undocumented stored procedure
sp_msforeachdb 'CREATE TABLE dbo.Huh (i INT)'



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -