-- For example, if the test stored procedure is generated in the tempdb environment, the string does not support "go" declare @ SQL nvarchar (max) set @ SQL = 'use tempdbgocreate procedure p_testasselect 1 'exec (@ SQL)/* Interest 102, limit 15, limit 1, row 2 is not correct when it approaches 'Go. Interest 111, interval limit 15, interval limit 1, line 5 'create/alter procedure 'must be the first statement for batch query. */-- Solution Method: -- 1. First, create a stored procedure for reading the original row in test using testgoif object_id ('cmd _ script', 'P ') is not nullddrop procedure into _scriptgocreate procedure into _script (@ SQL nvarchar (max) asexec (@ SQL) go-2. zookeeper generates the test queue stored procedure use tempdbgodeclare @ SQL nvarchar (max) set @ SQL = 'create procedure p_testasselect 1 'exec test. DBO. pai_script @ sqlgoif object_id ('test. DBO. p_test ') is not nullprint n' stored in progress already exists'/* stored in progress already exists */
I can see some netizens asking this kind of questions. There are several practical methods here.