How to capture a current db name in a connection | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

How to capture a current db name in a connection

I have two questions here. 1. How do I use a SQL statement to find out what database I am currently using in query anaylzer? 2. Is there a way I can use a SQL statement to retreive the database name being backed up in a backup job? Wing
sp_who will give you all that information.
Luis Martin
Moderator
SQL-Server-Performance.com Although nature commences with reason and ends in experience it is necessary for us to do the opposite, that is to commence with experience and from this to proceed to investigate the reason.
Leonardo Da Vinci Nunca esperes el reconocimiento de tus hijos, eso ocurrirá luego de tu muerte
All postings are provided “AS IS” with no warranties for accuracy.
1. select db_name() ——
> KH <
]]>