Good morning, all,
OK, I have read a ton of posting on this issue, but either they don't give enough information or they are for packages which use the Execute SQL command, whereas I am using the OLE DB Command Data Flow Transformation.
I have an Excel spreadsheet that we are receiving from agencies with rows of client data which I have to load into an application that is ready to go live. I also have a stored procedure spClientsInsertRcd, which was written for the application. In the normal flow of the application, the stored procedure is called from a Coldfusion page, which does some processing prior to calling it. So, I have written a 'wrapper' stored procedure, spImportAgencyData, which does the processing and then calls the spClientInsertRcd.
My dataflow has the following components:
An Excel Source, containing my test data, consisting of just one row of data,
which points to a
Derived Column Transformation, which reformats the SSN and adds a user variable, named returnValue with an Expression value of @.[User::returnvariable] set to a four-byte signed integer, which (i think) I need to get the value out of the stored procedure.
which points to a
Data Conversion Transformation, which takes care of all the datatype conversions
which points to a
OLE DB Command, which contains the following as the SQL Command:
exec ?= spImportAgencyData ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?
In the OLE DB Command, I have mapped returnValue, my user variable to @.RETURN_VALUE.
Right now, I am in initial testing. The dataflow shows that it is succeeding, but my one data record for testing is not getting inserted. I need to get the value of returnValue to figure out what is happening.
How do I get the value of the returnValue? I have tried putting a recordset destination after the OLE DB command, but that just gives me the data that went into the OLE DB Command.
Thanks,
Kathryn
OK,
I have made a few changes to the package and I can get a return value. The problem is that the data, which is currently only one row in an Excel worksheet, is not getting loaded.
The OLE DB Command's SQL Command is now:
exec spImportAgencyData ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,? output
with the final parameter being an output parameter. On the Column Mappings tab, I have mapped the output parameter @.returnValue which is in the Available Destination Columns to the returnValue variable (in the Available Input Columns) I created earlier in the Derived Column Transformation.
I have added a recordset Destination after the OLE DB Command and I only have the returnValue column in it.
The returnValue is always being returned as 0, which is either because I am not mapping it correctly or because the data is not getting loaded, I'm not sure which.
I can run the stored procedure from SQL Server Management Studio as
DECLARE @.returnValue int
EXEC [dbo].[spImportAgencyData]
@.URN = NULL,
@.FirstName = N'Kathryn',
@........
@.returnValue = @.returnValue OUTPUT
SELECT @.returnValue as N'@.returnValue'
and the correct new ClientID is returned, so the stored procedure is working. I have put a Data Viewer right before the OLE DB Command and run the stored procedure with the exact data coming from the Excel spreadsheet, just to double check and it runs and returns the new Client ID.
Does anyone have any tips on debugging this problem?
Thanks,
Kathryn
General:
Connection Type: OLE DB
SQL Statemenet: EXEC ? = AUDIT.LoggingStoredProcedure ?, ?
Bypass Prepare: True
Parameter Mapping:
[Variable Name] | [Direction] | [Data Type] | [Parameter Name]
User::ReturnValue | Return Value | Long | 0
User::Parameter1 | Input | VARCHAR | 1
USer::Parameter2 | Input | VARCHAR | 2
No comments:
Post a Comment