Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Old way of checking if item exists before drop
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
You can’t perform that action at this time.