Skip to content

Instantly share code, notes, and snippets.

@phpleo
Created January 5, 2011 15:42
Show Gist options
  • Select an option

  • Save phpleo/766472 to your computer and use it in GitHub Desktop.

Select an option

Save phpleo/766472 to your computer and use it in GitHub Desktop.
Insertar un registro si no existe
-- http://stackoverflow.com/questions/639854/tsql-check-if-a-row-exists-otherwise-insert
IF NOT EXISTS (SELECT * FROM Bookings WHERE FLightID = @Id)
BEGIN
--UPDATE HERE
END
ELSE
BEGIN
-- INSERT HERE
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment