0
I need to save data from a table to a database command and return that data to the same table after a while...
I thought I’d do something like this:
DECLARE @NOME_FILIAL VARCHAR(25);
DECLARE @DATA_AJUSTE DATETIME;
DECLARE @CODIGO_FILIAL CHAR(6) = '300135';
SET @NOME_FILIAL = (SELECT FILIAL FROM FILIAIS WHERE COD_FILIAL = @CODIGO_FILIAL);
SET @DATA_AJUSTE = (SELECT DATA_AJUSTE FROM ESTOQUE_PRODUTOS
WHERE FILIAL = @NOME_FILIAL AND DATA_AJUSTE IS NOT NULL
GROUP BY DATA_AJUSTE)
UPDATE ESTOQUE_PRODUTOS SET DATA_AJUSTE = '20190309'
WHERE FILIAL = @NOME_FILIAL AND DATA_AJUSTE IS NOT NULL
DELETE FROM LJ_ETL_REPOSITORIO WHERE ID_ETL_TIPO='171'
AND FILTRO LIKE '%' + @NOME_FILIAL + '%'
PRINT @DATA_AJUSTE
UPDATE LJ_ETL_ARQUIVO SET PROCESSADO = '1'
WHERE ID_ETL_TIPO = '6'
AND CODIGO_FILIAL = @CODIGO_FILIAL
The problem is that the data in the DATE _ADJUSTMENT column will not always be the same.... I would really appreciate it if you could help me out.......
Take a back-up of the table, change as you like, back-up at the end of everything. Or is that not what I meant?
– anonimo
I can’t do this because the bank communicates with another, at the time of returning bkp will surely be a problem....
– Filippe Natan
why not put it in a temporary table?
– Ricardo Pontual
Save the content in another column !? I don’t know if I understand the problem.
– Motta
One possibility is to make all changes within a transaction and at the end give a ROLLBACK instead of a COMMIT.
– anonimo