June 29, 2012 at 4:19 pm
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,?))A
JOIN
(SELECT DISTINCT * FROM [Forward_Mar&Apr2012]
WHERE [Valuation Process Date DD]=?)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]
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..
July 2, 2012 at 1:43 am
Try it like this:
DECLARE @Param0 datetime;
DECLARE @Param1 datetime;
SET @Param0 = ?;
SET @Param1 = ?;
SELECT DISTINCT * FROM
(SELECT DISTINCT * FROM [Forward_Mar&Apr2012]
WHERE [Valuation Process Date DD]=DATEADD(DD,-1,@Param0))A
JOIN
(SELECT DISTINCT * FROM [Forward_Mar&Apr2012]
WHERE [Valuation Process Date DD]=@Param1)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];
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply