Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. ALTER PROCEDURE [dbo].[Forecast_DeleteResults]
  2. @Forecast_ID int, --Forecast ID, kuriam yra sudaromos prognozes. tai ID is lentos [viss_portal].[dbo].[forecast]
  3. @Method int = NULL,
  4. @SourceType int
  5.  
  6. AS
  7. BEGIN
  8. -- Pirminiai duomenys
  9. if (@SourceType = 1)
  10. begin
  11.  
  12. DELETE FROM viss_portal.dbo.for_stage_results
  13. WHERE Forecast_ID=@Forecast_ID
  14. AND for_method_desc_id = ISNULL(@Method, for_method_desc_id)
  15.  
  16. -- Trinam ir issaugotus duomenis
  17. DELETE FROM viss_portal.dbo.for_results
  18. WHERE Forecast_ID=@Forecast_ID
  19. and for_method_desc_id = ISNULL(@Method, for_method_desc_id)
  20.  
  21. --Jei trinami visi metodai, trinam ir pacial prognoze
  22. if (@Method = NULL)
  23. begin
  24. DELETE FROM forecast_method where forecast_id = @Forecast_ID;
  25. DELETE FROM forecast where id = @Forecast_ID;
  26. end
  27. end
  28.  
  29. -- Issaugoti duomenys
  30. if (@SourceType = 2)
  31. begin
  32. DELETE FROM viss_portal.dbo.for_results
  33. WHERE Forecast_ID=@Forecast_ID
  34. and for_method_desc_id = ISNULL(@Method, for_method_desc_id)
  35. end
  36.  
  37. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement