Friday, August 02, 2013

T-SQL IF Exists Table Drop and Add - SQL Server

IF EXISTS(SELECT * FROM dbo.sysobjects WHERE ID = OBJECT_ID('[dbo].[tbl_staging_services_to_summary]'))
 BEGIN
  --PRINT 'tbl_staging_services'
  DROP TABLE [dbo].[tbl_staging_services_to_summary]
  PRINT 'Table Dropped and Recreated'
 END
ELSE
 BEGIN
 PRINT 'No Table Existed - Created Completed'
 END
Post a Comment