Changing values in a DTS Gobla Variable… | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Changing values in a DTS Gobla Variable…

Hi, I´m executing a stored procedure with output variables inside a DTS "Execute SQL Task". I store the output values in Package global variables. The code that I´m running to set the output values for the procedure is: CREATE PROCEDURE [dbo].[P_VALIDAR_FICH_COMPENSADOSCC] @valor_out int OUTPUT
AS — Declaring cursor DECLARE C_ESTADO_CENTRALES CURSOR FOR
select a2.central,….. — Opening cursor… OPEN C_ESTADO_CENTRALES
FETCH NEXT FROM C_ESTADO_CENTRALES
INTO @v_central, @v_ok IF @v_ok=’KO’
BEGIN SET @valor_out=10 INSERT INTO TE_ERROR_GENERAL (LCV_COD_TABLA, LCV_COD_PAQUETE, LCV_DES_ERROR)
VALUES (‘DATAMART_SP.COMPENSADOS’,’PCK_CARGA_COMPENSADOS’,@v_central+’ – ‘[email protected]_ok) –COMMIT RETURN –0
END
.
.
.
The output value from "@valor_out" is related to a DTS global variable called "vg_valor_out". The problem is the next: The "vg_valor_out" value only is changed to the "valor_out" value when the piece of code corresponding to the INSERT statement is commented. ¿Why can´t I execute the INSERT statement together with the SET statement? I´m not very skillfull with transact and I think it´s basic Knowledge but, Can anybody help me? Regards.

Links – fyi.
http://www.sqldts.com/default.aspx?205
http://msdn.microsoft.com/SQL/sqlwa…ary/en-us/dnsqlmag01/html/dts2000inaction.asp
http://databasejournal.com/features/mssql/article.php/3116201 Satya SKJ
Moderator
http://www.SQL-Server-Performance.Com/forum
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
]]>