SQL + Subtracting SmallDateTimes

  • 15 years ago

    below is my stp.  However, i get an arithmetic overflow converting expreession to smalldatetime.  How could I do this?



    SELECT DISTINCT j.SummonsFileddt, jg.Filenum
    FROM         tblJob j INNER JOIN
                         tbl
    JobGroup jg ON j.JobGroupid = jg.JobGroupid
    WHERE     (jg.FileClosedt IS NOT NULL) AND (jg.Clientvv = 11) AND (jg.Clientpk = 9343) OR
                         (jg.Client
    pk = 9619) OR
                         (jg.Clientpk = 15428)
    GROUP BY j.SummonsFiled
    dt, jg.Filenum, jg.FileClosedt
    HAVING      (jg.FileClosedt - j.SummonsFileddt >= DATEADD(d, - 15, GETDATE()))

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” - Antoine de Saint Exupéry