반응형
- /**********************************************************************************************
-- Title : [2k] 업데이트와 함께 변수에 값 저장하기
-- Reference : 웹검색
-- Key word : update, set
**********************************************************************************************/ - use pubs
- begin tran
declare @price money - select price "원래값" from titles
where title_id = 'bu1032' - update titles
set @price = price = price + 1 -- 업데이트와 동시에 변수 저장
where title_id = 'bu1032' - select @price "저장된 변수값"
- select price "변경된값" from titles
where title_id = 'bu1032'
rollback - select @price "롤백 이후의 변수값"
- select price "롤백 이후의 값" from titles
where title_id = 'bu1032'
반응형