Re: datepart + dateadd



Also, is the format for DateTime MDY or if it is something else like DMY in
your case?

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF


"Sylvain Lafontaine" <sylvain aei ca (fill the blanks, no spam please)>
wrote in message news:eJ84NeSVGHA.4452@xxxxxxxxxxxxxxxxxxxxxxx
Looks good to me, I don't see the error.

Maybe replacing nchar(2) with nvarchar(2) and removing the trailing « ,
0 » at the end of the convert functions.

Whats happens if you remove the Between clause and move the cast function
from the Where to the Select statement?

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF


"JEM" <Jenn@xxxxxxxxxxxxxxxxx> wrote in message
news:1143841863.179260.93530@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Thanks. I'm still not doing something right. Here is what i have:

SELECT dbo.tblChild.FName, dbo.tblChild.LName,
dbo.tblChild.Birthday
FROM dbo.tblChild
WHERE
(CAST(CONVERT(nchar(2), DATEPART(month, dbo.tblChild.Birthday), 0) +
N'/' +
CONVERT(nchar(2), DATEPART(day, dbo.tblChild.Birthday), 0) + N'/' +
CONVERT(nchar(4), DATEPART(year, GETDATE()), 0) AS datetime)
BETWEEN DATEADD(d, 21, GETDATE()) AND DATEADD(d, 28, GETDATE()))

Any ideas? I keep getting an error message that says something about
arithmetic overflow.





.



Relevant Pages