数据库篇之存储过程[bsp_getuserordercount]-BrnShop1.9升级至2.1升级说明(非官方版本)

差异图片如下

更新方式

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


©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页