Search SupportSQL
« Blocking info – waiter and blocker quick info | Main | BCP All Tables Into A Directory »
Monday
16Mar2009

moot modify scripting in SSMS: the never-modifying-modify-script

…a little gotcha for setting settings in SSMS, if you turn on the option to script an IF NOT EXISTS clause then this is what the modify stored procedure script comes out as below (just the first part pasted). Ouch! This will never modify anything and still return: Command(s) completed successfully.

/****** Object: StoredProcedure [dbo].[procMyProc] Script Date: 03/12/2009 10:08:11 ******/

SET

ANSI_NULLS ON

GO

SET

QUOTED_IDENTIFIER ON

GO

IF

NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N‘[dbo].[procMyProc]’) AND type in (N‘P’, N‘PC’))

BEGIN

EXEC

dbo.sp_executesql @statement = N‘ALTER PROCEDURE [dbo].[procMyProc]

 

—by Alek Kirstein – SupportSQL.com

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.
Member Account Required
You must have a member account on this website in order to post comments. Log in to your account to enable posting.