AnnieRider
MIS
Hi
I want to select data entered in the last full month.
I have set up the following as a seperate dataset
select dateadd(mm,datediff(mm,0,GetDate())-1,0) [FirstDate],
dateadd(dd,-1,dateadd(mm,datediff(mm,0,GetDate()),0)) [LastDate]
I have then created parameters Start and End and have set Default Queried values to those returned in this dataset.
In my main query I want to select records where DateStart is between @Start and @End I have used
WHERE(dbo.CR_HISTORY.HistoryType_Ref = 'H') AND (dbo.CR_HISTORY.UserFlag3 = 1) AND dbo.CR_HISTORY.DateStart > @Start) AND (dbo.CR_HISTORY.DateStart < @End)
But I get the error
arithmetic overflow error converting expression to data type smalldatetime
I (think I) know that the issue is that the dataset is returning the date in the wrong format but I don't know how or where to fix this.
Thanks for reading
Annie
I want to select data entered in the last full month.
I have set up the following as a seperate dataset
select dateadd(mm,datediff(mm,0,GetDate())-1,0) [FirstDate],
dateadd(dd,-1,dateadd(mm,datediff(mm,0,GetDate()),0)) [LastDate]
I have then created parameters Start and End and have set Default Queried values to those returned in this dataset.
In my main query I want to select records where DateStart is between @Start and @End I have used
WHERE(dbo.CR_HISTORY.HistoryType_Ref = 'H') AND (dbo.CR_HISTORY.UserFlag3 = 1) AND dbo.CR_HISTORY.DateStart > @Start) AND (dbo.CR_HISTORY.DateStart < @End)
But I get the error
arithmetic overflow error converting expression to data type smalldatetime
I (think I) know that the issue is that the dataset is returning the date in the wrong format but I don't know how or where to fix this.
Thanks for reading
Annie