Today I wanted to know what database I currently was connected to in an SQL-script (since I dynamically set the database name when calling SQLCMD) and found out that there is a simple function for this: db_name()
SELECT DB_NAME()
http://technet.microsoft.com/en-us/library/ms189753.aspx
Wednesday, January 16, 2008
How to determine the current database in MSSQL
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment