Click to See Complete Forum and Search --> : Trouble with SQL Task Output in DTS


TSmooth
November 1st, 2006, 01:51 PM
Using SQL Server 2000, I have created a DTS package. This package contains an "Execute SQL" task which runs the following stored procedure:


CREATE PROCEDURE dbo.SyncStart
AS
INSERT INTO tblSyncLog (SyncStart, SyncStatus)
VALUES (GetDate(), 'In Progress')
SELECT @@Identity As NewSyncID;


The Execute SQL task code is simply:

EXEC SyncStart


I also created a global variable in the package called "SyncID" of type Integer with default value of 0 which is being set to the row value output of this SQL Task, NewSyncID.

On completion of this Execute SQL Task I have an ActiveX Script task which simply does "MsgBox(DTSGlobalVariables("SyncID").Value)" for debugging purposes. However, despite the stored procedure working when I test it in Query analyzer and returning a single row/column result containing the new ID, my global variable is always 0 and I don't understand why it's not being set properly.

Any ideas?

- Tom

TSmooth
November 1st, 2006, 02:01 PM
I solved it. The problem was not setting NOCOUNT ON in the stored procedure which was screwing up the return value in the package.