Passing parameter issue in SSIS Execute SQL Task
Hi, I'm passing string variable and comparing with other values in table in EXECUTE SQL TASK. When i use question mark for providng inputs ?, I'm getting "Syntax error, permission violation, or other nonspecific error". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly" PLease reply me. Its very urgent. Sample code given below: DECLARE @Date DATETIME SELECT @Date = MAX(date) from tablename SELECT CASE WHEN CONVERT(DATETIME,?) > @date THEN 1 ELSE 0 ENDShree
November 19th, 2011 11:25am

For each '?' you use, you need to map that against some variable in parameter mapping tab. See if that is not done in this case!
Free Windows Admin Tool Kit Click here and download it now
November 19th, 2011 11:31am

Just use Expression. Go to properties -> Expression. Or http://msdn.microsoft.com/en-us/library/cc280502.aspxRandy Aldrich Paulo MCTS(BizTalk 2010/2006,WCF NET4.0), MCPD | My Blog
November 19th, 2011 11:36am

I mapped the parameter in Parameter mapping tab. Even after i cudn't get...Shree
Free Windows Admin Tool Kit Click here and download it now
November 19th, 2011 1:12pm

I am not sure why it is failing, but you could use alternate way of achieving this as mentioned below: 1. Try to build the expression (like below) in a string variable and set that variable's "Evaluate Expression" property to true. In the expression below, Variable2 is the one to which you are planning to map in parameter mapping page. If that variable type is already string, you need not include the data conversion. "DECLARE @Date DATETIME SELECT @Date = MAX(date) from tablename SELECT CASE WHEN " + (DT_STR,10, 1252) @[User::Variable2] + "> @date THEN 1 ELSE 0 END AS col1" 2. In Execute SQL task, set SQLSourceType as "Variable" instead of "Direct Input" and the variable having set with below expression. 3. Now, if you want to copy the result of this SELECT statement into a variable you could do so by setting "Result set" property and providing the mapping for it in "Result Set" tab.
November 19th, 2011 3:41pm

Hi, Check the below link on how to pass the parameter to the SQL Task (here we have used a sample datatime variable) which you can chage it accordingly to your requirement. http://beyondrelational.com/blogs/sherryli/archive/2011/08/27/ssis-99-pass-a-date-time-parameter-to-the-execute-sql-task.aspxThanks Karthikeyan Anbarasan http://f5debug.net/
Free Windows Admin Tool Kit Click here and download it now
November 20th, 2011 12:26am

First class.. I got it yaar.. Thanks a ton Deepak.Shree
November 20th, 2011 12:43am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics