Skip to content

Instantly share code, notes, and snippets.

@sankars
Created April 29, 2014 06:59
Show Gist options
  • Select an option

  • Save sankars/11392552 to your computer and use it in GitHub Desktop.

Select an option

Save sankars/11392552 to your computer and use it in GitHub Desktop.
-- From http://stackoverflow.com/questions/121243/hidden-features-of-sql-server
DELETE FROM (table)
OUTPUT deleted.ID, deleted.Description
WHERE (condition)
INSERT INTO MyTable(Field1, Field2)
OUTPUT inserted.ID
VALUES (Value1, Value2)
UPDATE (table)
SET field1 = value1, field2 = value2
OUTPUT inserted.ID, deleted.field1, inserted.field1
WHERE (condition)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment