jeudi 2 juin 2016

Limit script to run only on specific databases

I have databases

DEV_a    TST_a    REAL_a
DEV_b    TST_b    REAL_b
DEV_c    TST_c    REAL_c

These can be on same server or on different server. Now I'm writing a script/transaction that's relevant only for DEV_a, TST_a and REAL_c.

Is there any way I can limit script to run only on those databases?

I thought this might work:

USE [DEV_a]

but that would force it to run only on one database, but I have a list. Is this doable?

Extra question: if it is doable, can I run parts of the script for DEV_a and TST_a but different part of script for REAL_c?

Aucun commentaire:

Enregistrer un commentaire