示例Sql
set @s ='select @ischuku=isnull(ischuku,''n''),@warehouseId=warehouseId,@proID=proid from Warehouse where ' + @columnName + '=''' + @barCode +'''' EXEC sp_executesql @s, N'@ischuku varchar(1) output,@warehouseId varchar(10) output,@proID varchar(20) output', @ischuku output, @warehouseId output, @proID output;
关键地方
EXEC sp_executesql @s, N'@ischuku varchar(1) output,@warehouseId varchar(10) output,@proID varchar(20) output', @ischuku output, @warehouseId output, @proID output;