glebih (10/17/2016)
Assuming that an UPDATE statement effectively DELETEs and INSERTs a record, can the values not be retreived via OUTPUT ?IE
UPDATE table
SET Col1 = Val1
OUTPUT inserted.Col1 (should be Val1), deleted.Col1 (should be old value)
You are encouraged to start a new thread when your question differs enough from what the topic of the post is. For now though the answer to your question is yes
Try the following
create table #test(id int, string varchar(30))
insert into #test
values
(1,'row1'),
(2,'row2'),
(3,'row3'),
(4,'row4'),
(5,'row5'),
(6,'row6'),
(7,'row7'),
(8,'row8')
;
create table #hist (id int identity, oldVal varchar(30), newVal varchar(30))
;
update #test
setstring = 'row 4'
output deleted.string, inserted.string into #hist(oldVal, newVal)
whereid=4
Select * From #test
select * from #hist
----------------------------------------------------