无法像程序语言那样写SQL查询语句,提示“数据库中已存在名为 '#temp1' 的对象。”

夙愿已清 提交于 2020-04-06 23:11:14
 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
    

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!