Suggestion for Dropping table

sriramphanisriramphani Posts: 8
edited May 31, 2010 8:14AM in SQL Compare Previous Versions
Hi,

While scripting "drop table" like

PRINT N'Dropping [dbo].[Print]'
GO
DROP TABLE [dbo].[Print]
GO

If you could add

PRINT N'Dropping [dbo].[Print]'
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Print]') AND type = N'U'
DROP TABLE [dbo].[Print]
GO

Then it will be more useful. In SQL 2008, if I script the table to drop, it will give me a script similar to the one that I suggested.

Thanks,
Sriram.

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hi Sriram,

    Thanks for your suggestion. This is in our bug tracking system as a request for enhancement (SC-4044). SQL Compare doesn't check the existence of tables because it is designed to produce a script to be run immediately on the databases being compared, and therefore it's assumed that the object does exist because it was there during the comparison.

    What we really need to do is have an option to create migration scripts that were not necessarily designed to be run in-place.
Sign In or Register to comment.