Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DDQ: Lookup stored proc doesn't return value

Status
Not open for further replies.

Sonix

Programmer
Mar 5, 2001
16
GB
I'm using a data driven query with a lookup query that calls the following stored procedure:
Code:
CREATE PROCEDURE sp_getnextid (
  @key CHAR(20), @next_id d_count OUTPUT )
AS
SELECT  @next_id  = (NEXT_NO+1) FROM NEXT_NO
WHERE NEXT_KEY =  @key
UPDATE NEXT_NO SET NEXT_NO = @next_id
WHERE NEXT_KEY =  @key

RETURN @next_id
GO
In the Lookup query section I make a call to the procedure as:
Code:
DECLARE @next d_count 
EXEC sp_GetNextID @key = 'ITEM_ID', @next_id = @next OUTPUT 
SELECT @next
and have tested this works in Query Analyser. So in my ActiveX transformation script I then call the lookup as:
Code:
Dim itemID
itemID = DTSLookups("getNextID").Execute()
' assign parameters for insert
DTSDestination("ITEM_ID") 	= itemID
but although the procedure runs fine (the NEXT_NO table gets updated) the assignment for ITEM_ID fails. Can anyone help. The message I get is:

...encountered an invalid date value for 'ITEM_ID' destination column.

Please help. Its driving me mad!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top