Showing posts with label return. Show all posts
Showing posts with label return. Show all posts

Thursday, March 29, 2012

Database Name

Hi,

Can anyone tell me how to return the current database name using T-SQL.

I have a stored proc that runs in a number of databases and would like qualify some dynamic sql with the database name. I know DB_Name exists but requires the DB_ID and DB_ID needs the DB_Name. Is there a function that just returns the current database i.e.

USE TestDB

GO

SELECT currentDBName?

Use the following function..

Select db_name()

|||

Cheers...

sql

Friday, February 24, 2012

Database Mail fails to email Operator

Sqlserver 2005 SP2
Hi All,
Upon completion of a job, an email should be sent to an operator but instead
it return the following error:
Message
The job succeeded. The Job was invoked by User. The last step to run was
step 1 (Daily Backup). NOTE: Failed to notify 'John' via email.
I am able to send the test email without any issues so I am not sure why the
email notification does not go through.
Regards
JN
Try to verify the privileges of the SQL Server Agent Service Account;
More important: do you configured Database Mail and created a profile for it
(and added members to DatabaseMailUserRole of msdb)?
Look at Books on line the topics related to Database Mail
Gilberto Zampatti
"JN" wrote:

> Sqlserver 2005 SP2
> Hi All,
> Upon completion of a job, an email should be sent to an operator but instead
> it return the following error:
> Message
> The job succeeded. The Job was invoked by User. The last step to run was
> step 1 (Daily Backup). NOTE: Failed to notify 'John' via email.
> I am able to send the test email without any issues so I am not sure why the
> email notification does not go through.
> Regards
> JN
>
>

Database Mail fails to email Operator

Sqlserver 2005 SP2
Hi All,
Upon completion of a job, an email should be sent to an operator but instead
it return the following error:
Message
The job succeeded. The Job was invoked by User. The last step to run was
step 1 (Daily Backup). NOTE: Failed to notify 'John' via email.
I am able to send the test email without any issues so I am not sure why the
email notification does not go through.
Regards
JNTry to verify the privileges of the SQL Server Agent Service Account;
More important: do you configured Database Mail and created a profile for it
(and added members to DatabaseMailUserRole of msdb)?
Look at Books on line the topics related to Database Mail
Gilberto Zampatti
"JN" wrote:
> Sqlserver 2005 SP2
> Hi All,
> Upon completion of a job, an email should be sent to an operator but instead
> it return the following error:
> Message
> The job succeeded. The Job was invoked by User. The last step to run was
> step 1 (Daily Backup). NOTE: Failed to notify 'John' via email.
> I am able to send the test email without any issues so I am not sure why the
> email notification does not go through.
> Regards
> JN
>
>