November 25, 2023 at 3:38 pm
Hello,
I am trying to reference the results from the Inserted or Deleted tables from a SQL Trigger in teh @query param of sp_sendmail but doesn't seem to work. Getting the dreaded: Msg 22050, Level 16, State 1, Line 54
Failed to initialize sqlcmd library with error number -2147467259. This usually happens when you are not using a fully qualified table. You need to include the database but no matter how I write the query, even when making as basic as possible doesn't seem to be able to access it. Any suggestions besides dumping the results from Inserted and Deleted to a real table and then referencing it in the @Query param for sp_Sendmail?
Thanks,
Daniel
November 25, 2023 at 7:07 pm
The inserted and deleted "tables" only exist within the direct code of a trigger. You can't reference them from an external query. You'd need to write the inserted and deleted rows to an actual table(s) to reference them in any external query.
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
November 25, 2023 at 9:46 pm
Figured. Thank you.
November 29, 2023 at 6:11 am
This was removed by the editor as SPAM
November 29, 2023 at 7:40 am
This was removed by the editor as SPAM
December 5, 2023 at 3:45 am
This was removed by the editor as SPAM
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply