February 14, 2011 at 10:06 am
Hi,
I have a query that is filtered by StartDate and EndDate
WHEN I used
DECLARE @StartDate DATETIME
DECLARE @EndDate DATETIME
SET @StartDate = '01/01/2011'
SET @EndDate = '02/02/2011'
And in the query I use something like this SettlementDate >= @StartDate AND SettlementDate <= @EndDate
I get the error that
The variable @StartDate is already declared. It can be declared only once.
Please help.
February 14, 2011 at 11:11 am
PSB (2/14/2011)
Hi,I have a query that is filtered by StartDate and EndDate
WHEN I used
DECLARE @StartDate DATETIME
DECLARE @EndDate DATETIME
SET @StartDate = '01/01/2011'
SET @EndDate = '02/02/2011'
And in the query I use something like this SettlementDate >= @StartDate AND SettlementDate <= @EndDate
I get the error that
The variable @StartDate is already declared. It can be declared only once.
Please help.
Do you also have a declared parameter named @StartDate?
While there is noting wrong with declaring variables in the query for a dataset, usually report parameters take their place.
Also you could also write your where clause like SettlementDate Between @StartDate and @EndDate. Personally I think this reads a little easier.
February 14, 2011 at 11:40 am
Thanks I removed the Declare Statements from my query and just used where Settlementdate Between @StartDate and @EndDate.
Thay worked. Thanks.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply