T-SQL Add the INTO clause for the OUTPUT clause

Encerrado Postado 1 ano atrás Pago na entrega
Encerrado Pago na entrega

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]

Programação de Banco de Dados Microsoft SQL Server T-SQL (Transact Structures Query Language)

ID do Projeto: #34708044

Sobre o projeto

9 propostas Projeto remoto Ativo em 1 ano atrás

9 freelancers estão ofertando em média $21 nesse trabalho

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 Mais

$10 USD em 1 dia
(9 Comentários)
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 Mais

$20 USD in 7 dias
(3 Comentários)
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 Mais

$30 USD in 3 dias
(0 Comentários)
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 dias
(0 Comentários)
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 Mais

$30 USD em 1 dia
(0 Comentários)
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 Mais

$20 USD em 1 dia
(0 Comentários)
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 dias
(0 Comentários)
0.0