Looping of databases

15 pts.
Tags:
Database
T-SQL
The query which works only in one database at a time. How to make it run in databases at once (like a loop one database after the other) is there any query to that?
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

You could use ms_spforeachdb but I would check out this post for a better option.

http://sqlblog.com/blogs/aaron_bertrand/archive/2010/12/29/a-more-reliable-and-more-flexible-sp-msforeachdb.aspx

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • clark445kent
    Hi,

    I am not clear with your query not, so please provide more details.

    Thanks & Regards
    Clark Kent
    8,235 pointsBadges:
    report
  • narmukutty
    i created a sp for loading the sizes of the tables in one database i want to run this sp in all the databases at once. i have 132 databases. this sp should run in all databases one after the other. 
    15 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: