If I want to know the server I can use:
@@SERVERNAME
Is there an equivalent function for getting database/catalog name.
I know that we can set it in the script with USE
statement but what if it wasnt set and I wanted to query within a sproc what db I was using.
db_name()
will give you the name of the current database.