导航

 if exists(
    select 
        exp_count
    from
        tbl_expend
    where 
        exp_valid = 1 and exp_public = 0 and exp_monthly = 0 and  convert(varchar(7),exp_date,120) = convert(varchar(7),cast('2020/04/03 22:57:20'as datetime ),120)  
)
    begin
        select 
            exp_count
        into #temp1
        from
            tbl_expend
        where 
            exp_valid = 1 and exp_public = 0 and exp_monthly = 0 and  convert(varchar(7),exp_date,120) = convert(varchar(7),cast('2020/04/03 22:57:20'as datetime ),120)  
    end
else
    begin
        select 0 as exp_count into #temp1        
    end