Created
January 17, 2018 21:33
-
-
Save cpoDesign/17fb8e291863d10e4d42790d8659385e to your computer and use it in GitHub Desktop.
Old way of checking if item exists before drop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IF EXISTS(SELECT 1 FROM sys.objects AS O WHERE O.name = 'Product' AND O.[type] = 'U') | |
BEGIN | |
DROP TABLE [SomeTable] | |
END | |
IF OBJECT_ID('dbo.Product', 'U') IS NOT NULL | |
BEGIN | |
DROP TABLE dbo.Product; | |
END | |
IF EXISTS (SELECT * FROM sys.triggers WHERE name = 'trProductInsert') | |
BEGIN | |
DROP TRIGGER trProductInsert | |
END | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment