mssql 变量之间的传值 存储过程: CREATE procedure [dbo].[OneGoods] @year char(4)='', @goods nvarchar(100)='', @ageid varchar(10)='', @ret int=0 output, @RetStr nvarchar(500)='' output as DECLARE @getcount int declare @temp varchar(10) set @getcount=0 select @getcount= sum([count]) from outlog where date like (@year+'-11%') and goodsinfo =@goods and ageid=@ageid if(@getcount is null) begin set @temp=@RetStr+'*0' set @RetStr=@temp end else begin set @temp=@RetStr+'*'+CONVERT (nvarchar(100),@getcount ) set @RetStr=@temp end print @RetStr