Execute SQL Task Parameterized SP
I have a Stored Procedure that takes in a Bit Parameter (0/1) that i want to execute from a Execute SQl Task. The value for the parameter needs to come in from a user defined variable.
The Exec SQL Task command is Exec spName ?
I have added a parameter of Type Variant_Bool Name as 0 and Size as 1.
The ByPassPrepare is set to false.
the SP Executes but it does not seem to pick up the variable that i set, any ideas?
Regards, Dinesh
August 6th, 2012 12:48pm
For this to work you should be using OleDB source. Also,
General settings should be:
Connection Type: OLEDB
SQLStatement: Exec spName ?
ByPassPrepare : True
SQLSourceType: Direct Input
Parameter MApping should be:
VariableName: <what ever boolean variable you hvae created>
Direction: input
DataType: VARIANT_BOOL
ParameterName: 0
ParameterSize: -1
Set above settings and it should work.
Please mark the post as answered if it answers your question
Free Windows Admin Tool Kit Click here and download it now
August 6th, 2012 1:56pm
Ok I tried the code with the same setting. However it does not seem to pick up the change in the variable, i ran the sql profiler it always passes the value 0, irrespective of changing the user defined variable as true/false.
Any Idea why?Regards, Dinesh
August 6th, 2012 2:38pm
use debugger and add watch to see if the value is properly assigned to the Boolean variables. OR set the default value of the variable to "True" and see what you receive in the SQL profiler.Please mark the post as answered if it answers your question
Free Windows Admin Tool Kit Click here and download it now
August 6th, 2012 2:41pm
Thanks, the problem is with the Boolean Variables, the Paramters are not getting assigned the values when i change the variable value, i worked around the scenario by adding a precedence constraint and redirecting the control to different tasks.
will post the answer if i find what's stopping the code from understanding the variable valueRegards, Dinesh
August 7th, 2012 2:01pm
you can mail me the package and i can have a look for you. my emayl is DotNetMonster7 at-sign yahoo dot-sign com
Please mark the post as answered if it answers your question
Free Windows Admin Tool Kit Click here and download it now
August 7th, 2012 2:11pm
Thanks, the problem is with the Boolean Variables, the Paramters are not getting assigned the values when i change the variable value, i worked around the scenario by adding a precedence constraint and redirecting the control to different tasks.
will post the answer if i find what's stopping the code from understanding the variable value
Regards, Dinesh
To set the bit value in the Stored Proc just use the Integer e.g. DT_I2 type of a variable. Make sure you mapped that properly, reading the thread this seems to be the issueArthur My Blog
August 7th, 2012 2:41pm