SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Run through a list of database script
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

5 Posts

Posted - 08/12/2008 :  09:48:10  Show Profile  Reply with Quote
I am using SQL-manager to create queries and the like. I have to check all databases whether a specific table (same name in every database) has a specific field set to identity specification = yes.

How can I do that. How can I run a script that runs through every database on the server..?

Flowing Fount of Yak Knowledge

7174 Posts

Posted - 08/12/2008 :  14:25:52  Show Profile  Reply with Quote
You can use Objectproperty() to check whether identity exists in specific table and loop through all tables with sp_MSforeachtable.
Go to Top of Page

Very Important crosS Applying yaK Herder

52325 Posts

Posted - 08/12/2008 :  14:39:37  Show Profile  Reply with Quote
you can use sp_Msforeachdb to run through all dbs in your server
Go to Top of Page

Starting Member

5 Posts

Posted - 08/13/2008 :  02:43:08  Show Profile  Reply with Quote
Thank you very much.. I will try that right away.. :)
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000