Passing parameter to a query in OLEDB source
I am using the following query in my OLEDB source SELECT DISTINCT * FROM(SELECT DISTINCT * FROM [Forward_Mar&Apr2012]WHERE [Valuation Process Date DD]=DATEADD(DD,-1,?))AJOIN(SELECT DISTINCT * FROM [Forward_Mar&Apr2012]WHERE [Valuation Process Date DD]=?)BONA.[Deal ID (Num) DD]=B.[Deal ID (Num) DD]ANDA.[Contract Month]=B.[Contract Month]ANDA.[Buy or Sale]=B.[Buy or Sale]ANDA.[Effective From Date]=B.[Effective From Date]ANDA.[Effective To Date]=B.[Effective To Date] So, there is a parameter in this query..when I hit the parameters button..I am getting an error.. Parameters cannot be extracted from the sql command etc. etc. This query is running absolutely fine in sql server if I initialize that variable..Can anyone tell me whats the problem here..
June 29th, 2012 6:15pm

I do think ....It is one of the inconsistent errors that represent some strange behavior , thus I came up with the below workaround for such cases when you need to pass parameters to OLEDB source editor Paste your TSQL code in the OLEDB source editor. Include your place holders (question marks) where your variables will be placed.Click on the "Build Query" button. You'll see a familiar query builder boxClick the arrow "Run" buttonThe dialog box "Query Parameters" opens up; there should be a placeholder for each of your parametersFill in a value for each. The dates in mine can be any value that you choose.Click OK and your query will run. Click OK again and you're back to the OLE DB Source Editor.Click your parameter button again. Success! Your variables are now mapped. Kindly work out them and let me know your feedback Shehap (DB Consultant/DB Architect) Think More deeply of DB Stress Stabilities
Free Windows Admin Tool Kit Click here and download it now
July 2nd, 2012 4:10am

I do think ....It is one of the inconsistent errors that represent some strange behavior , thus I came up with the below workaround for such cases when you need to pass parameters to OLEDB source editor Paste your TSQL code in the OLEDB source editor. Include your place holders (question marks) where your variables will be placed.Click on the "Build Query" button. You'll see a familiar query builder boxClick the arrow "Run" buttonThe dialog box "Query Parameters" opens up; there should be a placeholder for each of your parametersFill in a value for each. The dates in mine can be any value that you choose.Click OK and your query will run. Click OK again and you're back to the OLE DB Source Editor.Click your parameter button again. Success! Your variables are now mapped. Shehap (DB Consultant/DB Architect) Think More deeply of DB Stress Stabilities
July 2nd, 2012 4:12am

Well... I guess you have other work around as well here. Like, Say... Declare a variable 'var_SQLQuery' then go to that variable's property and set 'EvaluateAsExpression' as 'True'. Now set the 'Expression' property as: "SELECT DISTINCT * FROM (SELECT DISTINCT * FROM [Forward_Mar&Apr2012]WHERE [Valuation Process Date DD]=DATEADD(DD,-1," + @User::var_myParamValue +"))AJOIN(SELECT DISTINCT * FROM [Forward_Mar&Apr2012]WHERE [Valuation Process Date DD]= "+ @User::Var_myParamValue +")B ON A.[Deal ID (Num) DD]=B.[Deal ID (Num) DD]AND A.[Contract Month]=B.[Contract Month]AND A.[Buy or Sale]=B.[Buy or Sale]AND A.[Effective From Date]=B.[Effective From Date]AND A.[Effective To Date]=B.[Effective To Date]" --- Finallly you use var_SQLQuery as the Source variable for your DFT's OLEDB Source.       Regards, Avik M.
Free Windows Admin Tool Kit Click here and download it now
July 2nd, 2012 6:20am

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

Other recent topics Other recent topics