Add an option to generate DROP statements?
rgribble
Posts: 88
I am using RedGate toolkit to generate creation scripts for all objects in a database, to store in source control. I was previously using SQLDMO to achieve this and there was an option in that (and in Enterprise Manager) to add a DROP statement to the start of the script, so it could be run whether the item exists or not.
For the time being i have had to add my own support for generating the DROP statements, but ultimately it would be great if the toolkit supported an option in the Options enumeration to generate this for me!!
For the time being i have had to add my own support for generating the DROP statements, but ultimately it would be great if the toolkit supported an option in the Options enumeration to generate this for me!!
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Venue]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[Venue] GO CREATE TABLE [dbo].[Venue] ( [VenueId] [smallint] NOT NULL, ... etc
Comments
Thanks for your post. Lots of customers continue to ask for the if exist...drop to be added as an option. I don't knwo if and/or when we'll ever see this get done.