Is there a way to use Create Or Alter in earliest version of SSMS
JonathanL
Posts: 1 New member
in SQL Compare
Hi,
So my problem is that I have many clients using a version of ssms prior to 14. I know there's the "Add CREATE OR ALTER for rerunnable scripts" but this only work in the later version. So, is there any way to use something like this instead :
IF NOT EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND OBJECT_ID = OBJECT_ID('dbo.sp_StoredProcName')) exec('CREATE PROCEDURE [dbo].[sp_StoredProcName] AS BEGIN SET NOCOUNT ON; END')GO ALTER PROCEDURE dbo.sp_StoredProcName
AS
I'm using SQL Compare 14 and 15
Thank you,
Have a great day.
So my problem is that I have many clients using a version of ssms prior to 14. I know there's the "Add CREATE OR ALTER for rerunnable scripts" but this only work in the later version. So, is there any way to use something like this instead :
IF NOT EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND OBJECT_ID = OBJECT_ID('dbo.sp_StoredProcName')) exec('CREATE PROCEDURE [dbo].[sp_StoredProcName] AS BEGIN SET NOCOUNT ON; END')GO ALTER PROCEDURE dbo.sp_StoredProcName
AS
I'm using SQL Compare 14 and 15
Thank you,
Have a great day.
Tagged:
Answers
I think in this case you can use object existence checks here: https://documentation.red-gate.com/sc/using-the-command-line/options-used-in-the-command-line#Optionsusedinthecommandline-Addobjectexistencechecks
Kind regards
Dan Calver | Redgate Software
Have you visited our Help Center?