While sending the mail through SQL Server using DBMail, sometimes we get the error message “Failed to initialize sqlcmd library with error number -2147467259”. This is because there is an issue with the execution. The possible scenarios are given below –
1) SQLCMD is unable to execute the code because it doesn’t know in which database the code needs to be executed
2) Invalid table name
3) Invalid column names
Check the code and correct the name of the table or column for the second and third reasons.
For the first reason, use three-part name in your SELECT statement
(Eg. DBName.dbo.TableName).
Otherwise use the input parameter “@execute_query_database”
(Eg. @execute_query_database = ‘YourDBName’).
Do let me know if you are still facing the same error.
One comment