Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
T-SQL sp_msforeachdb example
EXEC sp_msforeachdb '
if ''?'' LIKE ''CMS[_]%'' begin
print ''?'';
use [?]
select setting as TransactionGateway, ''?'' as [Database]
from dbo.Setting with(nolock)
where Id = ''TransactionGateway''
END
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.