zoukankan      html  css  js  c++  java
  • sql2005 isnull的用法

    ALTER PROCEDURE [dbo].[Proc_GetCustomerForNewSalesSignDate]
    AS
    BEGIN
        /*declare @months int        --取深圳分公司系统设置月数
        select @months=SettingValue from SystemSettings
        where OrganizationID=1    --取深圳分公司系统设置
        and SettingKey=24        --销售新队?月没有签单的客户自动放入大鱼池
        if (@months is null)    --默认6个月
        set @months=6*/
        select c.CompanyID
        from company c
        inner join CompanyExtension ce on ce.companyid=c.companyid
        inner join systemuser su on su.id=c.SalesID
        left join SystemSettings ss on ss.OrganizationID=ce.OrganizationID
        and ss.SettingKey=24    --销售新队?月没有签单的客户自动放入大鱼池
        where
        c.Status=1                --审核通过
        and c.DelStatus=1        --未删除客户
        and c.MemberType <> 3    --不是正式客户
        and c.SalesID is not null
        and ce.AssignState = 2    --是销售新队在跟踪的客户
        and su.IsDummy is not null
        and su.IsDummy <>1        --排除虚拟用户
        and c.AllocateDate is not null
        and dateadd( day, -(isnull(ss.SettingValue,6)*30),getdate()) > c.AllocateDate --分配半年
        and (not EXISTS(
            select ct.companyid from [contract] ct
            where ct.companyid = c.companyid
            and ct.contractmoney>0
            and ct.Status<3
        ))        
    END
  • 相关阅读:
    将网址设为首页和添加到收藏夹(JS脚本)
    窗体居中一句话
    链接跳转JS
    工厂学习心得(三)Asp.net
    工厂模型学习心得(一)(ASP.Net)
    ubuntu终端快捷键
    Win7锐捷:无法找到网卡或系统未完成网卡初始化操作.请稍后再尝试认证
    Xming的使用
    在Windows上建立ssh服务器
    Windows XP循环启动
  • 原文地址:https://www.cnblogs.com/ylemzhang/p/1599942.html
Copyright © 2011-2022 走看看