Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to initialize sqlcmd library with error number -2147024809

Tags:

sql-server

I created a new email profile with the super admin and I configured the smtp.

Then when I execute this query:

   exec msdb.dbo.sp_send_dbmail
   @profile_name ='admin_mail',
   @recipients = '[email protected]',
   @execute_query_database = 'DashboardPowerBi',
   @query = 'select top 20 from Client_1',
   @subject= 'Liste des clients',
   @body_format ='HTML',
   @attach_query_result_as_file = 1;

I get this error:

Failed to initialize sqlcmd library with error number -2147024809

like image 948
M_M Avatar asked Apr 24 '26 02:04

M_M


2 Answers

Recently i had an issue related with this, the solution here was to fully qualified the DATABASE + SCHEMA_NAME + TABLE_NAME ('select * from sales..sales_month'), even if you're in the same database.

Regards!

like image 146
Xmex Avatar answered Apr 25 '26 21:04

Xmex


Well, the query is incorrect. You need to specify which columns you are selecting

@query = 'select top 20 * from Client_1',

But rather than using '*', actually list the columns you want.

like image 45
Robert Sievers Avatar answered Apr 25 '26 22:04

Robert Sievers



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!