码迷,mamicode.com
首页 > 数据库 > 详细

sql4

时间:2014-07-15 09:45:39      阅读:336      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   2014   div   line   

USE [MainDb]
GO

/****** Object:  StoredProcedure [dbo].[BackDataUpdate]    Script Date: 07/15/2014 08:46:25 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

Create PROCEDURE [dbo].[ProcChatOnlineByAddDateStatisticSelect]
(
    @sDate VARCHAR(10),
    @eDate VARCHAR(10) 
)
AS
BEGIN TRAN
    DECLARE @ID AS INT
    BEGIN TRY
        SET @ID=0
        SELECT TOP 1 @ID=ID FROM backdata WITH(NOLOCK) WHERE
            ManagerID=@ManagerID AND CountDate=YEAR(GETDATE())*10000+MONTH(GETDATE())*100+DAY(GETDATE())
        IF @ID=0
            INSERT INTO backdata(ManagerID,CountDate) VALUES(
                @ManagerID,YEAR(GETDATE())*10000+MONTH(GETDATE())*100+DAY(GETDATE())
            )
        
        IF @Pass=1    
            UPDATE backdata SET resume_pass=resume_pass + 1 WHERE
                ManagerID=@ManagerID AND CountDate=YEAR(GETDATE())*10000+MONTH(GETDATE())*100+DAY(GETDATE())
        IF @Pass=10
            UPDATE backdata SET resume_nopass=resume_nopass + 1 WHERE
                ManagerID=@ManagerID AND CountDate=YEAR(GETDATE())*10000+MONTH(GETDATE())*100+DAY(GETDATE())
    END TRY
    BEGIN CATCH
        GOTO ERR
    END CATCH
COMMIT TRAN
RETURN 1
ERR:
BEGIN
    ROLLBACK TRAN
    RETURN 0
END





GO

 

sql4,布布扣,bubuko.com

sql4

标签:style   blog   color   2014   div   line   

原文地址:http://www.cnblogs.com/ustcyc/p/3843947.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!