Hi community,
I have a SQL that consolidates blocks of records with into a larger records. These rows are inserted into a new database. The consolidation is rather complex. So I wrote a CLR Stored Procedure to consolidate these blocks. The new rows contain more columns. Many of them contain the consolidated data from these blocks. The CLR SP return a row into an INSERT ... EXECUTE. pls. refer to the code shown.
To avoid channeling additional column data thru the Stored Procedure I would like to INSERT some data after the SP has returned. Is there any coding to add value for additional columns with the INSERT ... EXEC? Or would you solve a task totally different?
Many thanks in advance!
WHILE @@fetch_status = 0 BEGIN SET @AnlagenschlüsselLast = @Anlagenschlüssel SET @Count = 0 BEGIN TRY INSERT INTO dbo.pamSQLFinalWind ( Anlagenschlüssel, [Originating ÜNB], [Abrechnungsjahr], [Energie kWh], [EEG Subvention EUR]) EXECUTE dbo.pamEEGDecomposition @Anlagenschlüssel, @ÜNB, @Abrechnungsjahr, @COUNT OUTPUT; END TRY BEGIN CATCH INSERT INTO dbo.pamSQLFinalWindErrors ( Anlagenschlüssel, [Originating ÜNB], Nummer, Severity, [Stored Procedure], Zeile, Fehlerbeschreibung) VALUES (@AnlagenschlüsselLast, @ÜNB, ERROR_NUMBER(), ERROR_SEVERITY(), ERROR_PROCEDURE(), ERROR_LINE(), ERROR_MESSAGE()); END CATCH FETCH RELATIVE @Count FROM Cursor_Anlagenschlüssel INTO @Anlagenschlüssel, @Menge, @Subvention, @ÜNB SET @TotalCount += @Count SET @BatchCount += 1; END
Regards Uwe