Hi All,
I have a Execute SQL Task I get some values from a table onto three variables. Next step in a DFT, I try to execute a stored proc by passing these variables as parameters.
EXEC [dbo].[ETLloadGROUPS]
@.countRun =?,
@.startTime =?,
@.endTime = ?
This is the syntax i use, in the parameters tab of the DFT I ensured that all the parameters are correctly mapped.
When I run the package, it executes successfully but no rows are fectched. I tried running the stored proc manually in the database, and it seems to work fine.
Am I missing something here ? Please Advice
Thanks in Advance
I am sure it is a type issue. SSIS has a VERY VERY irritating feature of not telling you it can't convert your var to the SQL type you set in the parameters section, it just ignores it and sets it to nothing.Try setting your vars to "String" types and your parameters in the task to "VARCHAR". I bet it will work.
You might also try setting vars inside the SQL to the ?. I have had issues where it doesn't like ? in certain places.
DECLARE @.count INT, @.stime datetime, @.etime datetime
SET @.count = ?
SET @.stime = ?
SET @.etime = ?
EXEC [dbo].[ETLloadGROUPS]
@.countRun =@.count,
@.startTime =@.stime,
@.endTime = @.etime|||
Tom,
Thanks for the quick response. but guess am into a soup here... I have done the following in the parameters tab of the Execute SQL Task.
varName Direction Datatype ParaName
user::countRun Input varchar 0
user:endDate input varchar 1
user:runDate Input varchar 2
In the result set , I have done the following,
Result Name variable Name
0 user::countRun
1 user:endDate
2 user:runDate
al the three variables are of the datatype String.
when I execute the package its now failing with the error, the type of the value assigned to the variable differs from the current datatype. I guess the values from the table which are int and date are not accepted in this parameter mapping. How to handle this?
Thanks for the help so far
|||It sounds like you don't have dates in the strings. What are the values of the parameters you are passing.Try this:
SET @.count = CAST(? AS INT)
SET @.stime = CAST(? AS DATETIME)
SET @.etime = CAST(? AS DATETIME)
You could run the SQL Profiler and capture exactly the command it is running.
|||
When you say "no rows are fetched" how are you determining this?
what are you doing with the results of the sqltask?
|||Hi Jeff,
My whole idea is to query a table, get three values onto three variables, pass these values to a stored procedure and then get the entire set of records returned by the proc and then insert it to another OLE DB Destination.
|||Tom Phillips wrote: It sounds like you don't have dates in the strings. What are the values of the parameters you are passing. Try this:
SET @.count = CAST(? AS INT)
SET @.stime = CAST(? AS DATETIME)
SET @.etime = CAST(? AS DATETIME)You could run the SQL Profiler and capture exactly the command it is running.
I am selecting all the three values from a table and then passing them to a stored procedure.
|||Hi All,
I have solved all the issues, now at the last summit though its giving me an error with the OLE DB Source component where am calling the stored proc. The erorr is, A rowset based on the SQL Command was not returned by the OLE DB Provider.
Any idea to resolve this ?
Thanks in advance.
|||adding "SET NOCOUNT ON" at the start of the stored proc resolved the issue. Thx for all the help :)
No comments:
Post a Comment