(The below task is not for real life; this is from a job interview)
I have a DML trigger on a SQL Server 2012 table. The logic of the trigger requires to read the trigger's virtual table inserted
and copy the data into a log table.
It is OK; but one of the task conditions is that this "copy the data into a log table" should be done using sp_exequtesql
.
But the Dynamic SQL code in sp_exequtesql
does not see the trigger’s virtual tables, does it?
Any ideas how to cope with this?