How can I write a SQL query to get the DB name ? Usually we use SELECT DB_NAME() AS DataBaseName, but at that time teh DB is in use. If we didn;t write use [dbname][/dbname], is there any way to get the DB name ?
Software/Hardware used:
SQL 2008
ASKED:
June 29, 2010 11:35 AM
UPDATED:
June 30, 2010 3:43 PM
Not all RDBMSes have the ability to tell you what instance or location or whatever.
So at install time, I make it a practice to always add a table containing any and all pieces of info anyone might want. Make the table available to everyone.
table might include INSTANCE, LOCATION, LPAR, DATE INSTALLED, SOFTWARE VERSION, …
Caveat – just remember to update the info if you clone this instance