差异图片如下
更新方式
1.删除存储过程
2.新建存储过程
语句如下:
GO DROP PROCEDURE [bsp_getuserordercount] GO CREATE PROCEDURE [bsp_getuserordercount] @uid int, @startaddtime varchar(30), @endaddtime varchar(30), @orderstate tinyint AS BEGIN SET NOCOUNT ON; DECLARE @condition nvarchar(1000); SET @condition = ''; IF @orderstate > 0 SET @condition = ' AND [orderstate]=' + STR(@orderstate); IF @startaddtime <> '' SET @condition = @condition + ' AND [addtime]>=''' + @startaddtime + ''''; IF @endaddtime <> '' SET @condition = @condition + ' AND [addtime]<=''' + @endaddtime + ''''; EXEC('SELECT COUNT([oid]) FROM [bsp_orders] WHERE [uid]=' + @uid + @condition); END GO