Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Administration - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 6525

SP fails with [298] SQLServer Error: 773Failed to Initialise sqlcmd library with error number -2147467259

$
0
0
HelloI have written a stored procedure to send the results of a query to me when a particular condition is met. This is the syntax I am attempting to run:SET NOCOUNT ON; EXEC msdb.dbo.sp_send_dbmail @profile_name = 'KCSIS Visitor', @recipients = [<my email address>], @subject = 'KCSIS - Visitor with unsupervised access to pupils', @query = 'SELECT dbo.TblSafeguardVisitors.DateOfAct, dbo.TblSafeguardVisitors.Name_Of_Speaker, dbo.TblSafeguardVisitors.Member_Of_Staff_Hosting, dbo.TblSafeguardVisitors.Dept_Act, dbo.TblSafeguardVisitors.Unsupervised, dbo.TblSafeguardVisitors.Known, dbo.TblSafeguardVisitors.ReferenceTaken, dbo.TblSafeguardVisitors.InternetResearched, dbo.TblSafeguardVisitors.OtherCheck, dbo.TblSafeguardVisitors.Notes, dbo.TblSafeguardVisitors.Entered_ByFROM dbo.CurrYearT INNER JOIN dbo.TblSafeguardVisitors ON dbo.CurrYearT.DateOfKCSIS < dbo.TblSafeguardVisitors.DateOfActWHERE (dbo.TblSafeguardVisitors.Unsupervised = 1) WITH (NOLOCK)', @sensitivity = 'Confidential', @body = 'An entry has been made for a new speaker with unsupervised access to children. Below is the last entry made. ' ENDWhenever I attempt to run it, I get the error messageMsg 22050, Level 16, State 1, Line 16Failed to initialize sqlcmd library with error number -2147467259.However, if I REM out the query, the SP works fine and I receive the email. Being paranoid about the syntax of the underlying query, I even went into creating a view and got it to write the SQL syntax for me - but still to no avail. Checking the error log for

Viewing all articles
Browse latest Browse all 6525

Trending Articles