Skip to content

Instantly share code, notes, and snippets.

@BryanWilhite
Last active August 29, 2015 14:09
Show Gist options
  • Save BryanWilhite/b07cc28a6bad426a0e07 to your computer and use it in GitHub Desktop.
Save BryanWilhite/b07cc28a6bad426a0e07 to your computer and use it in GitHub Desktop.
t-SQL: CREATE TABLE preamble
IF EXISTS (SELECT * FROM sysobjects WHERE id = object_id(N'[dbo].[MyTable]')
AND OBJECTPROPERTY(id, N'IsUserTable') = 1) --also: type = 'U'
BEGIN
DROP TABLE [dbo].[MyTable]
END
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment