日期:2014-05-18 浏览次数:20646 次
CREATE PROCEDURE procGetCurNo ( @tblName VARCHAR(256) , @curid0 INT OUTPUT ) AS declare @sql nvarchar(4000) set @sql=N'select @curid0=max(id0) + 1 from '+convert(nvarchar(256),@tblName) exec sp_executesql @sql,'@curid0 int output',@curid0
------解决方案--------------------
CREATE PROCEDURE procGetCurNo ( @tblName VARCHAR(256) , @curid0 INT OUTPUT ) AS declare @sql nvarchar(4000) set @sql=N'select @curid0=max(id0) + 1 from '+convert(nvarchar(256),@tblName) exec sp_executesql @sql,'@curid0 int output',@curid0 --楼主的意思,应该还要返回这个出参值