T-SQL Add the INTO clause for the OUTPUT clause

Kapalı İlan edilme: 1 yıl önce Teslim sırasında ödenir
Kapalı Teslim sırasında ödenir

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]

Veritabanı Programlama Microsoft SQL Server T-SQL (Transact Structures Query Language)

Proje NO: #34708044

Proje hakkında

9 teklif Uzak proje Aktif 1 yıl önce

Bu iş için 9 freelancer ortalamada $21 teklif veriyor

freelancepraful

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 Daha Fazla

1 gün içinde %bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% USD
(9 Değerlendirme)
4.4
CourserXu

Hello there, I have read your requirements and am confident I am the right candidate for the job. Among other things, I have over ten years of experience in Oracle PLSQL, PostgreSQL, MySQL, MS SQL, and others. Furtherm Daha Fazla

$20 USD in 7 gün içinde
(3 Değerlendirme)
3.8
wilfrednjorog

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 Daha Fazla

$30 USD in 3 gün içinde
(0 Değerlendirme)
0.0
rakeshkohale

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.

$20 USD in 7 gün içinde
(0 Değerlendirme)
0.0
topgradeclubltd

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 Daha Fazla

1 gün içinde %bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% USD
(0 Değerlendirme)
0.0
ogbio

With over 5years experience as a database administrator I would be the best match for this job, a trial will convince you as I have been trained by world leading institutions and my certifications says it all. I am loo Daha Fazla

1 gün içinde %bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% USD
(0 Değerlendirme)
0.0
bsreenathreddy20

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.

$10 USD in 7 gün içinde
(0 Değerlendirme)
0.0