You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IF NOT EXISTS (SELECT schema_name FROMinformation_schema.schemataWHERE schema_name ='rollback_schema')
BEGIN
EXEC sp_executesql N'CREATE SCHEMA rollback_schema'
END
CREATETABLErollback_schema.update_foos_bar (id INT, bar VARCHAR(255);
IF EXISTS (select1from foos where bizz ='Update this')
BEGINUPDATE foos
SET bar ='Updated value'
OUTPUT deleted.id, deleted.bar INTO rollback_schema.update_foos_barWHERE bizz ='Update this'
END
Rollback
UPDATE f
SET bar =r.barFROM foos f
JOINrollback_schema.update_foos_barONf.id=r.idDROPTABLErollback_schema.update_foos_bar