我不明白为什么以下给我的错误。我认为它与注释部分有关,但@SQL是nvarchar(4000)。'sp_executesql'附近语法不正确
BEGIN
sp_executesql N'SELECT ''td'''
--sp_executesql @SQL, N'@StartDate DateTime, @EndDate DateTime, @End2 DateTime, @Program varchar(4)', @StartDate, @EndDate, @End2, @Program
END
您可以调用存储过程没有和exec,但只有当调用存储过程是块中唯一的语句。 – 2009-08-18 23:05:40
它必须是第一个声明,不一定是唯一的声明。 – Tao 2010-07-06 17:15:55