我正在嘗試執行此查詢,但它打印@ TABLESQL11值但未執行。可以幫助任何人執行。sql查詢未執行
declare @maxCount int
set @maxCount=3
DECLARE @TABLESQL11 VARCHAR(4000)
set @TABLESQL11='insert into temp11 '
set @[email protected]+ 'select attendeeid,Activities,date,time'
DECLARE @j INT
SET @j =1
WHILE @j <[email protected]
BEGIN
set @TABLESQL11 = @TABLESQL11+',q'+CONVERT(VARCHAR,@j)+',A'+CONVERT(VARCHAR,@j)
SET @j = @j+1
END
set @[email protected]+' from temp1'
print @TABLESQL11
exec (@TABLESQL11)
在此先感謝。
它不是執行 – Sree 2011-05-06 17:16:31