Re: datepart + dateadd



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

  • Error from DMAX in VBA
    ... I’m getting an error message “Run-time Error ‘2001’: ... This code works without errors when I don’t include the Where Clause ... OOrder is the field in the table tblOCode that holds the sequential numbers. ... SCode is unique in tblSCode. ...
    (microsoft.public.access.modulesdaovba)
  • RE: Strange error when querying FoxPro dbase
    ... I understand that you get the error message ... when using columns defined with AS inside the WHERE clause. ... This is a restriction related to SQL Command. ... INNER JOIN fldunit ON fldunit.id=fldscorpio.fu_id ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: adoQuery - unspecified error on open
    ... unused ADOQuery component on my datamodule and connected it via the same ... > produces an error message vs the anticipated result ... > connection string ... > actually is you remove the parameter and the in clause, ...
    (borland.public.delphi.database.ado)
  • Re: What is the problem with my SELECT statement ?
    ... The error message from JET displays only a limited number of characters, but my WHERE clause is longer and in this case the error is not visible in the message. ... I hope some time, some day I will find the time to write a real SQL designer, that will help the user pretty-print SQL statements and will ...
    (microsoft.public.access.queries)
  • Re: adoQuery - unspecified error on open
    ... > produces an error message vs the anticipated result ... > actually is you remove the parameter and the in clause, ... > get the parameters yesterday but have since broken them as well. ... If I try to use a parameter, even in design it is not ...
    (borland.public.delphi.database.ado)