Auto detect DB instances
A client of mine has a software and has many instances of it (one per project). They all share the same SQL server. But there's one DB catalog for each instance. Is it possible, in T-SQL, to auto-detect the catalogs of a SQL server? Or maybe I开发者_如何学Python can send the catalog name in a parameter to the stored proc? I didn't figure out how to do this. It causes an error in the query.
SELECT * FROM @CatalogDotTableName
Do you have any clue?
Thanks!
How about
SELECT name
FROM sys.databases
Seek in registry: HKLM "SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL"
精彩评论