zoukankan      html  css  js  c++  java
  • 关于存诸过程临时表的一个小运用

    USE [szmj]
    GO
    /****** Object:  StoredProcedure [dbo].[Par_ProductDownLoad]    Script Date: 05/26/2014 17:46:32 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    -- =============================================
    -- Author:        <Author,,Name>
    -- Create date: <Create Date,,>
    -- Description:]
    -- =============================================
    create PROCEDURE [dbo].[Par_ProductDownLoad] 
    @TemporaryInsertSql text,
    @shopid int
    AS
    BEGIN 
     if exists (select * from tempdb.dbo.sysobjects where id = object_id(N'tempdb..#TempDownload') and type='U')
     begin
         drop table #TempDownload
     end
        create table #TempDownload
        (
            OnLineProductId varchar(50),
            OnLineSkuId varchar(50),
            ShopId int
        )
        exec(@TemporaryInsertSql)
        update [PlatformSku] set SaleStatus='instock',SkuIsSync=0 where Id in(select p.ID from [PlatformSku] p where p.Id not in (select p.ID from [PlatformSku] p inner join #TempDownload t on p.ShopId=t.ShopId where p.OnLineProductId=t.OnLineProductId and p.OnLineSkuId=t.OnLineSkuId and p.ShopId=@shopid) and ShopId=@shopid) and ShopId=@shopid
        --select 1 from #TempDownload t where p.OnLineProductId=t.OnLineProductId and p.OnLineSkuId=t.OnLineSkuId and p.ShopId=t.ShopId and p.ShopId=@shopid
        --select p.Id from [PlatformSku] p where not exists (select 1 from #TempDownload t where p.OnLineProductId=t.OnLineProductId and p.OnLineSkuId=t.OnLineSkuId and p.ShopId=t.ShopId and p.ShopId=@shopid)
        --update [PlatformSku] set SaleStatus='instock',SkuIsSync=0 where Id in(select p.Id from [PlatformSku] p where not exists (select 1 from #TempDownload t where p.OnLineProductId=t.OnLineProductId and p.OnLineSkuId=t.OnLineSkuId and p.ShopId=t.ShopId and p.ShopId=@shopid)) and
    END
  • 相关阅读:
    net core 2 读取appsettings.json
    转: C# 根据当前时间获取,本周,本月,本季度等时间段 .Net中Exception
    转:5种回到顶部的写法从实现到增强
    转:jQuery 常见操作实现方式
    NLog 自定义字段 写入 oracle
    转:C# 使用NLog记录日志
    转:NLog之:文件类型目标(File target)
    springboot2.x+jwt+shiro最简单、最快速整合方式
    windows部署mindoc
    docker安装mongodb
  • 原文地址:https://www.cnblogs.com/yingger/p/3753597.html
Copyright © 2011-2022 走看看