Boa tarde.
Estava tentando copiar os dados de uma tabela que sofreu um Update para uma nova tabela.
Por exemplo, tenho uma linha que sofreu um update, gostaria de copiar todos os dados desta linha para a nova tabela. estou usando o sql server , tentei fazer por alguns exemplos mas nao deu certo. seria correto usar Trigger ou seria melhor uma stored procedure?
segue codigo:
CREATE TRIGGER replicante ON dbo.JobInformation
for update
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
INSERT INTO BilhetagemIddeia.dbo.JobInformation(
Date,
UserJob,
DocumentName,
Path,
JobId,
JobPrinterDriverName,
JobPrinterObjectName,
JobPrinterPortName,
JobPrinterShareName,
JobSizeInBytes,
JobColor,
JobTotalPages,
JobNumCopies,
JobDuplex,
JobOrientation,
JobPrintQuality,
JobPaperSizeName,
Status,
DeletedTime,
NumPages,
NumPaper,
PrintedTime,
PrinterModel,
PrinterSerialNumber,
PrinterAddress)
values
(
select Date from inserted,
select UserJob from inserted,
select DocumentName from inserted,
select Path from inserted,
select JobId from inserted,
select JobPrinterDriverName from inserted,
select JobPrinterObjectName from inserted,
select JobPrinterPortName from inserted,
select JobPrinterShareName from inserted,
select JobSizeInBytes from inserted,
select JobColor from inserted,
select JobTotalPages from inserted
select JobNumCopies from inserted,
select JobDuplex from inserted,
select JobOrientation from inserted,
select JobPrintQuality from inserted,
select JobPaperSizeName from inserted,
select Status from inserted,
select DeletedTime from inserted,
select NumPages from inserted,
select NumPaper from inserted,
select PrintedTime from inserted,
select PrinterModel from inserted,
select PrinterSerialNumber from inserted,
select PrinterAddress from inserted)
END
GO
e o erro que acusa
Msg 156, Level 15, State 1, Procedure replicante, Line 41
Sintaxe incorreta prxima palavra-chave 'select'.
Msg 156, Level 15, State 1, Procedure replicante, Line 42
Sintaxe incorreta prxima palavra-chave 'select'.
Msg 156, Level 15, State 1, Procedure replicante, Line 43
Sintaxe incorreta prxima palavra-chave 'select'.
valeu a todos