ices-tools-prod / icesSAG

R interface to Stock Assessment Graphs database web services
https://sg.ices.dk/webservices.aspx
11 stars 7 forks source link

Copying last year stock status table #162

Closed cmspinto closed 6 years ago

cmspinto commented 6 years ago

The insert procedure was copying last years stock status table. Now it is generating a new one every time a stock is uploaded:


--------------------------------------- Import the SAG StockTable if already exists ------------------------------------

/ REMOVED BECAUSE IT WAS COPYING THE TABLE OF LAST YEAR (CARLOS AND DAVID REMOVED THIS FEATURE IN THE 30 OF APRIL OF 2018 ) if (@PreviousStockKey > 0) BEGIN IF EXISTS (SELECT FROM tblStockStatusLines WHERE (AssessmentKey = @PreviousStockKey) ) BEGIN INSERT INTO [dbo].[tblStockStatusLines] ([AssessmentKey],[linenumber],[LineDescription],[FishingPressureLabel],[FishingPressureStatus],[StockSizeLimitLabel],[StockSizeStatus],[CustomLabel],[CustomStatus]) SELECT @id AS [AssessmentKey], linenumber, LineDescription, FishingPressureLabel, FishingPressureStatus, StockSizeLimitLabel, StockSizeStatus, CustomLabel, CustomStatus FROM tblStockStatusLines WHERE (AssessmentKey = @PreviousStockKey)

        INSERT INTO [dbo].[tblStockStatusColumns]
                   ([AssessmentKey],[Year],[linenumber],[ColumnType],[status])
        SELECT     @id , Year, linenumber, ColumnType, status
        FROM         tblStockStatusColumns
        WHERE     (AssessmentKey = @PreviousStockKey)
    END
    ELSE
    BEGIN
        EXEC    [dbo].[up_createDefaultStockStatus] @AssessmentKey = @ID, @user = @user
    END

END */