DECLARE @script VARCHAR(MAX);
SET @script =
'
create table ali(id decimal(10,0));
drop table ali;
go
create table ali(id decimal(10,0));
drop table ali;
'
EXEC (@script);
Error message occured when execute above query. Please tell me if you have an idea for resolve this.
Msg 102, Level 15, State 1, Line 4 Incorrect syntax near 'go'.
Note : the above code for create and drop created table is just for example, i have some other dynamic queries with go statement. Please do not give this answer.
DECLARE @script VARCHAR(MAX),
@script1 VARCHAR(MAX);
SET @script =
'
create table ali(id decimal(10,0));
drop table ali;
';
SET @script1 =
'
create table ali(id decimal(10,0));
drop table ali;
';
EXEC (@script);
EXEC (@script1);