T-SQL Add the INTO clause for the OUTPUT clause
$10-30 USD
Plačilo ob prevzemu
We just want to show the inserted and deleted record in the COMMIT TRANSACTION errors so we can compare the errors for duplicate keys values easier. Add something to the OUTPUT clause so the transaction will execute and show the errors. This is for a Transaction with 50 tables so I don't want to have to create 50 temp tables. It could be that adding a string will work. Test database attached. You would need to add some triggers to re-create the error.
SELECT '' 'table1', * FROM [MergeAccounts].[dbo].[table1]
begin transaction
UPDATE [dbo].[table1]
SET [IDNUM] = 11111
OUTPUT '' ins, inserted.*, '' del, deleted.*
--OUTPUT '' ins, inserted.*, '' del, deleted.* INTO @string--The target table of the DML statement cannot have any enabled triggers if the statement contains an OUTPUT clause without INTO clause. Add INTO something.
WHERE IDNUM = 11113
--commit transaction
select @@error Error
If @@error = 0
COMMIT TRANSACTION
Else
ROLLBACK TRANSACTION
;
SELECT '' 'table1', * FROM [MergeAccounts].[dbo].[table1]
ID projekta: #34708044
Več o projektu
9 freelancerjev ponuja v povprečju za $21 na tem delu
I can help you with sql server queries and triggers, please ping/connect me now I am available. Please check my reviews and project which I have completed. I can create sql queries for sql server database as per design Več
Hey! I am an expert writer with the vast skills and qualifications necessary for this job. I have experience in Database Programming, Microsoft SQL Server and T-SQL (Transact Structures Query Language). I am confiden Več
I am a Senior SQL developer with 7+ yrs of experience and I can take this task and will finish it successfully. I am looking for some active assignments to utilize my knowledge and free time and add value to your work.
Hi, Greetings and hoping you are doing well, i welcome you to my profile where quality and client satisfaction is the Priority. I am Expert Dominic and i hope to cooperate with you on your project . CERTIFIED EXPERT I Več
I have 2 years of experience on dynamic sql queries and creating tables,alter tables, update tables and also experence on store procedures,views, functions.