码迷,mamicode.com
首页 > 其他好文 > 详细

关于存诸过程临时表的一个小运用

时间:2014-05-28 03:07:11      阅读:269      评论:0      收藏:0      [点我收藏+]

标签:des   style   c   class   blog   code   

bubuko.com,布布扣
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(Ntempdb..#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
bubuko.com,布布扣

 

关于存诸过程临时表的一个小运用,布布扣,bubuko.com

关于存诸过程临时表的一个小运用

标签:des   style   c   class   blog   code   

原文地址:http://www.cnblogs.com/yingger/p/3753597.html

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