Guest User

Untitled

a guest
Oct 19th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 1.43 KB | None | 0 0
  1.  
  2. USE [Atyrau]
  3. GO
  4. /****** Object:  StoredProcedure [dbo].[pInsertSendDataStatuses]    Script Date: 09/07/2012 11:05:36 ******/
  5. SET ANSI_NULLS ON
  6. GO
  7. SET QUOTED_IDENTIFIER ON
  8. GO
  9. ALTER procedure [dbo].[pInsertSendDataStatuses]
  10.   @ImportSession_ID int,
  11.   @CollectedData_ID int,  
  12.   @SendStatus_ID int
  13. as
  14.   set nocount on
  15.   declare
  16.     @SendDataStatus_ID int,
  17.     @NewCheck_Date date
  18.  
  19.   insert into
  20.     dbo.SendDataStatuses
  21.     (
  22.       ImportSession_ID,
  23.       CollectedData_ID,  
  24.       SendStatus_ID  
  25.     )
  26.   values
  27.     (
  28.       @ImportSession_ID,
  29.       @CollectedData_ID,  
  30.       @SendStatus_ID    
  31.     )
  32.    
  33.   set
  34.     @SendDataStatus_ID = scope_identity()  
  35.    
  36.   if (@SendStatus_ID not in (0,5))
  37.     --and not exists
  38.     -- (
  39.     --   select
  40.     --     1
  41.     --   from
  42.     --     dbo.PhotoChecks pc (nolock)
  43.     --     inner join
  44.     --       dbo.CollectedData cd (nolock)
  45.     --     on
  46.     --       pc.Task_ID = cd.Task_ID
  47.     --   where
  48.     --     cd.CollectedData_ID = @CollectedData_ID
  49.     -- )
  50.     --and not exists
  51.     -- (
  52.     --  select top 1
  53.     --    null
  54.     --  from
  55.     --    dbo.CollectedData (nolock)
  56.     --  where
  57.     --    CollectedData_ID = @CollectedData_ID
  58.     --    and isnull(Photo_Exists, 0) = 1
  59.     -- )
  60.   begin
  61.     set
  62.       @NewCheck_Date = getdate();
  63.      
  64.     execute dbo.pDeclineChecks @SendDataStatus_ID = @SendDataStatus_ID, @NewCheck_Date = @NewCheck_Date
  65.   end
Add Comment
Please, Sign In to add comment