I have a stored procedure starting as below in a .sql file,
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
IF OBJECT_ID(‘SP_ABCDEF’) IS NULL
EXEC(‘CREATE PROCEDURE DBO.SP_ABCDEF’)
ALTER PROCEDURE DBO.SP_ABCDEF
blah blah blah
when I read this file and pass the content as query string to execute query activity, I see the below
.Net SqlClient Data Provider : Incorrect syntax near 'GO’
Incorrect syntax near the keyword ‘ALTER’.
’CREATE/ALTER PROCEDURE’ must be the first statement in a query batch.
I don’t want to change anything and just run it as it is in the SQL file… Please see if you guys can share your thoughts around this,