I am going to have an agent that is running a stored procedure every 24 hours. This will be run on several different databases. Under certain conditions this proc will be sending an email to alert our admin of problems. I need to be able to specify in the email and in our error log which instance of SQL Server and what database name it came from.
I've got the server name and instance part with SERVERPROPERTY('servername')
but I couldn't find a way to get the current database name and I don't want to hardcode it since I would have to change it for every database we put this on.
Is there a function or an @@ that will tell me this?
Thanks,
Shanti
I've got the server name and instance part with SERVERPROPERTY('servername')
but I couldn't find a way to get the current database name and I don't want to hardcode it since I would have to change it for every database we put this on.
Is there a function or an @@ that will tell me this?
Thanks,
Shanti