22,210
社区成员
发帖
与我相关
我的任务
分享
set @IncList=''''+replace(@IncodeList,',',''',''')+''''
select @Num2=max(JiID) from T_SCWuL where InCode in(@IncodeList)
select @Num2=max(JiID) from T_SCWuL where InCode in(''''+replace(@IncodeList,',',''',''')+'''')
EXEC sp_executesql @sql,N'@Num2 int OUTPUT',@Num2 OUTPUT
set @IncList=''''+replace(@IncodeList,',',''',''')+''''
select @Num2=max(JiID) from T_SCWuL where InCode in(@IncodeList)
--这个应该是没有满足条件的
--至于第二句,要用sp_executesql这个系统存储过程
exec sp_executesql @sql,N'@Num2 int output',@Num2 output
set @IncList=''''+replace(@IncodeList,',',''',''')+''''
--select @Num2=max(JiID) from T_SCWuL where InCode in(@IncodeList)
DECLARE @SQL NVARCHAR(4000);
DECLARE @Num2 INT;
SET @SQL=N'select @Num2=max(JiID) from T_SCWuL where InCode in('+@IncList+N')';
EXEC sp_executesql @SQL,'@Num2 int OUTPUT',@Num2 OUTPUT;
SELECT @Num2;
declare @sql nvarchar(4000)
set @IncList=''''+replace(@IncodeList,',',''',''')+''''
set @sql=N'select @Num2=max(JiID) from T_SCWuL where InCode in('+@IncList+')'
EXEC sp_executesql @sql,N'@Num2 int output',@Num2 output