Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ALTER PROCEDURE [dbo].[Forecast_DeleteResults]
- @Forecast_ID int, --Forecast ID, kuriam yra sudaromos prognozes. tai ID is lentos [viss_portal].[dbo].[forecast]
- @Method int = NULL,
- @SourceType int
- AS
- BEGIN
- -- Pirminiai duomenys
- if (@SourceType = 1)
- begin
- DELETE FROM viss_portal.dbo.for_stage_results
- WHERE Forecast_ID=@Forecast_ID
- AND for_method_desc_id = ISNULL(@Method, for_method_desc_id)
- -- Trinam ir issaugotus duomenis
- DELETE FROM viss_portal.dbo.for_results
- WHERE Forecast_ID=@Forecast_ID
- and for_method_desc_id = ISNULL(@Method, for_method_desc_id)
- --Jei trinami visi metodai, trinam ir pacial prognoze
- if (@Method = NULL)
- begin
- DELETE FROM forecast_method where forecast_id = @Forecast_ID;
- DELETE FROM forecast where id = @Forecast_ID;
- end
- end
- -- Issaugoti duomenys
- if (@SourceType = 2)
- begin
- DELETE FROM viss_portal.dbo.for_results
- WHERE Forecast_ID=@Forecast_ID
- and for_method_desc_id = ISNULL(@Method, for_method_desc_id)
- end
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement