Is there anyway, using ADO (2.6) or T-SQL (SQL Server 2000) to find out the current database when you are connected?
Printable View
Is there anyway, using ADO (2.6) or T-SQL (SQL Server 2000) to find out the current database when you are connected?
Isn't it sitting in text in the CONNECTION STRING? Didn't you build the connection string in code?Quote:
Originally Posted by simonm
For the particular application I am building, the user can select which database he wishes to use. However, when connecting to a server, each login may have a default database.Quote:
Originally Posted by szlamany
I simply need to be able to query the connection to find out what my current database context is...
Use the db_name() function:
That will return the name of the current database.Code:Select db_name()
Thanks vb_dba!