这是我要的效果,三个参数 但是设置过滤条件时, 加下第三行就不能成立 ,但第三行单独设置成立, 加()号也不行,谢谢补充下 存储过程参数处理 if isnull(@FStockID1,'')<>'' and isnull(@FStockID2,'')<>'' begin set @sql = @sql+' and t2.FNumber between @FStockID1 and @FStockID2 ' set @sql=@sql + 'Order By t1.FNumber,u1.FBatchNo' end if isnull(@FNumber,'')<>'' begin set @sql = @sql + ' and t1.FNumber=@FNumber ' set @sql=@sql + 'Order By t1.FNumber,u1.FBatchNo' end print @sql exec sp_executesql @sql ,N'@FStockID1 nvarchar(50) ,@FStockID2 nvarchar(50) ,@FNumber nvarchar(50)' ,@FStockID1 ,@FStockID2 ,@FNumber 编辑于 2018-3-21 10:46 |
最佳回答 |
||||
0
|
|
|||
0
|
|
|||
0
|
|
|||
0
|
|
|||
0
|
|
|||
0
|
|