[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl-win32-users
Subject:    RE: DBI datetime problem
From:       "Joe Schell" <jschell () doradosoftware ! com>
Date:       2002-07-29 17:07:28
[Download RAW message or body]



> -----Original Message-----
> Behalf Of steve silvers
>
>
> I have a table with my enddate set as datetime on MS SQL Server.
> My script
> on an insert writes the date as 07/29/2002 into this column.
>
> My update script is something like
>
> UPDATE table SET Active = '0' WHERE (EndDate < 'GetDate()')
>

Unless I am missing something the expression

     'GetDate()'

will convert to

     'GetDate()'

In otherwords there is no date or time in it at all.  It is just text.


> I just want to look at the enddate and if it's the next day past it then
> update Active to 0.

That is not simple.  What do you mean by 'next day'.  For instance these are
all possible definitions:
-Past midnight.
-Past 3pm.
-Past 3pm timezone based.
-24 hours later
-24 business hours later (Sunday, holidays, etc don't count)
-1 calendar day later (so '7/28/2002 0:01:01' is one day later than
'7/27/2002 23:59:59')
-past sunset (complicated one)

And there are probably a large number of other variations.


>
> But I get the error:
> Syntax error converting datetime from character string. (SQL-22008)
>
> How can I do this?
>

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic