List Info

Thread: Re: -=(ASP-Support-Group)=- asp/sql date issue




Re: -=(ASP-Support-Group)=- asp/sql date issue
country flaguser name
United States
2007-02-19 04:16:53

That was my idea ;) A stopgap solution until he fixes his localisation
issue.

TonyWork
----- Original Message -----
From: "David Smart"; < smartware%40optusnet.com.au">smartwareoptusnet.com.au>
To: < ASP-Support-Group%40yahoogroups.com">ASP-Support-Groupyahoogroups.com>
Sent: Monday, February 19, 2007 9:20 AM
Subject: Re: -=(ASP-Support-Group)=- asp/sql date issue

>I wasn't suggesting converting the date fields to varchars. (Sorry - I
> probably gave the wrong impression from what I said.) It's simply a
> matter
&gt; of how you specify dates in SQL statements.
>
> Leave the dates in the database as date format.
>
> When you put a date into an SQL statement, format it to be YYYY-MM-DD.
>
> My VBScript is a bit rusty, but something like
>;
> sql = "SELECT * FROM [tblSubLinks] WHERE Active = 1 AND (dateLeaveHome IS
> NOT NULL) " & _
> "AND dateProgramStart > '" & format (now () - 1, "YYYY-MM-DD";) &
&gt; "' ORDER BY dateProgramStart";
>
>
> Regards, Dave S
>
> ----- Original Message -----
> From: "Moshe Tapnack&quot; < elists%40tapnack.com">eliststapnack.com>
&gt; To: < ASP-Support-Group%40yahoogroups.com">ASP-Support-Groupyahoogroups.com>
> Sent: Monday, February 19, 2007 3:16 PM
> Subject: RE: -=(ASP-Support-Group)=- asp/sql date issue
&gt;
>
>> Thanks David and Tony,
&gt;>
&gt;> Unfortunately server setup is my weak side :(
>&gt;
>&gt; In the meantime, I have added the getdate() to the SQL string, which
>>; seems
&gt;> to have solved the issue for now. But varchars sounds like the long term
>;> solution.
>>
>> Thanks again!
&gt;> Moshe
&gt;>
&gt;>
&gt;> -----Original Message-----
>&gt; From: ASP-Support-Group%40yahoogroups.com">ASP-Support-Groupyahoogroups.com
&gt;> [mailto: ASP-Support-Group%40yahoogroups.com">ASP-Support-Groupyahoogroups.com] On Behalf Of David Smart
&gt;> Sent: Sunday, February 18, 2007 10:46 PM
>&gt; To: ASP-Support-Group%40yahoogroups.com">ASP-Support-Groupyahoogroups.com
&gt;> Subject: Re: -=(ASP-Support-Group)=- asp/sql date issue
&gt;>
&gt;> Databases notoriously do not handle "UK&quot; date format - this is probably
>> true
>;>
>;> of SQL Server too. Convert all dates to international format -
>>; YYYY-MM-DD
>> in SQL statements so there will be no ambiguity to computer or human.
&gt;>
&gt;> You shouldn't have problems with that date format.
>>
>> The other alternative is to let the database engine supply the date (i.e.
&gt;> put the call to the date function inside the SQL string).
>>
>> Regards, Dave S
>&gt;
>&gt; ----- Original Message -----
>>; From: "Moshe Tapnack&quot; < elists%40tapnack.com">eliststapnack.com>
&gt;> To: < ASP-Support-Group%40yahoogroups.com">ASP-Support-Groupyahoogroups.com>
>> Sent: Monday, February 19, 2007 3:34 AM
>&gt; Subject: -=(ASP-Support-Group)=- asp/sql date issue
&gt;>
&gt;>
&gt;>> hey folks
&gt;>>
>>&gt; I have an ASP page, with an SQL Server 2000 backend.
>>&gt; the DB has a collation of Hebrew_CI_AS
>&gt;>
&gt;>> when I request records as follows:
>>&gt;
>&gt;> SELECT * FROM [tblSubLinks] WHERE Active = 1 AND (dateLeaveHome IS NOT
>>> NULL)
&gt;>> AND dateProgramStart > '" & now()-1 & "' ORDER BY dateProgramStart
&gt;>>
>>&gt; I get the following error, when dateProgramStart = 27/02/07 12:00:00 AM
>&gt;> :
>&gt;> The conversion of a char data type to a datetime data type resulted in
>>;> an
>&gt;> out-of-range datetime value.
&gt;>>
>>> Which points to the spot where I am comparing to yesterday's date.
&gt;>>
>>&gt; In SQL Management Studio, I see the dates as dd/mm/yyyy - as should be
>>;> as
>&gt;> defined (I think) by the Hebrew collation.
>>>
>>> I have found, that when I manually change the page LCID to that of an
>&gt;> american one (1033) - I do not get that error.
&gt;>>
>>> but when i have the LCID as Hebrew (or UK), as i want it, i get the
>>;> error
&gt;>> above.
&gt;>>
>>> so the data in the DB seems like its in the correct format, but when
>;>> accessed with the relevant LCID from ASP, it errors. only with the
>>> American
>>&gt; LCID (incorrect for this situation) - it errors.
>>>;
>>;> any ideas???
>>&gt;
>&gt;> Thanks!
>>>; Moshe
&gt;>>
>>&gt;
>&gt;>
&gt;>>
>>> Group homepage is here:
&gt;>> http://groups.yahoo.com/group/ASP-Support-Group
>>>;
>>;> To unsubscribe from this group, send an email to:
>>> ASP-Support-Group-unsubscribe%40yahoogroups.com">ASP-Support-Group-unsubscribeyahoogroups.com and cross your fingers
>>>; because Yahoo is 5h1te.
&gt;>>
>>> Yahoo! Groups Links
&gt;>>
>>&gt;
>&gt;>
&gt;>
&gt;>
&gt;>
&gt;> Group homepage is here:
&gt;> http://groups.yahoo.com/group/ASP-Support-Group
>>
>> To unsubscribe from this group, send an email to:
>> ASP-Support-Group-unsubscribe%40yahoogroups.com">ASP-Support-Group-unsubscribeyahoogroups.com and cross your fingers
>> because Yahoo is 5h1te.
&gt;>
&gt;> Yahoo! Groups Links
&gt;>
&gt;>
&gt;>
&gt;>
&gt;>
&gt;>
&gt;>
&gt;> Group homepage is here:
&gt;> http://groups.yahoo.com/group/ASP-Support-Group
>>
>> To unsubscribe from this group, send an email to:
>> ASP-Support-Group-unsubscribe%40yahoogroups.com">ASP-Support-Group-unsubscribeyahoogroups.com and cross your fingers
>> because Yahoo is 5h1te.
&gt;>
&gt;> Yahoo! Groups Links
&gt;>
&gt;>
&gt;>
&gt;
>
>
>; Group homepage is here:
&gt; http://groups.yahoo.com/group/ASP-Support-Group
>
> To unsubscribe from this group, send an email to:
> ASP-Support-Group-unsubscribe%40yahoogroups.com">ASP-Support-Group-unsubscribeyahoogroups.com and cross your fingers
> because Yahoo is 5h1te.
&gt;
> Yahoo! Groups Links
&gt;
>
>
>;

__._,_.___
.

__,_._,___
Re: -=(ASP-Support-Group)=- asp/sql date issue
country flaguser name
Australia
2007-02-19 07:05:59

Tony

Yeah I suspected that. But when I re-read my original reply: "Convert all
dates to international format - YYYY-MM-DD ...", I realised that I'd been
quite ambiguous.

Regards, Dave S

----- Original Message -----
From: "Tony Cheetham&quot; < Tony%40Enkidu.cx">TonyEnkidu.cx>
To: < ASP-Support-Group%40yahoogroups.com">ASP-Support-Groupyahoogroups.com>
Sent: Monday, February 19, 2007 9:16 PM
Subject: Re: -=(ASP-Support-Group)=- asp/sql date issue

> That was my idea ;) A stopgap solution until he fixes his localisation
> issue.
&gt;
> TonyWork
>; ----- Original Message -----
> From: "David Smart"; < smartware%40optusnet.com.au">smartwareoptusnet.com.au>
> To: < ASP-Support-Group%40yahoogroups.com">ASP-Support-Groupyahoogroups.com>
> Sent: Monday, February 19, 2007 9:20 AM
> Subject: Re: -=(ASP-Support-Group)=- asp/sql date issue
&gt;
>
>>I wasn't suggesting converting the date fields to varchars. (Sorry - I
>&gt; probably gave the wrong impression from what I said.) It's simply a
>&gt; matter
&gt;> of how you specify dates in SQL statements.
>>;
>>; Leave the dates in the database as date format.
>>
>> When you put a date into an SQL statement, format it to be YYYY-MM-DD.
>>;
>>; My VBScript is a bit rusty, but something like
>;>
>;> sql = "SELECT * FROM [tblSubLinks] WHERE Active = 1 AND (dateLeaveHome
>>; IS
>&gt; NOT NULL) " & _
>&gt; "AND dateProgramStart > '" & format (now () - 1, "YYYY-MM-DD";)
>>; &
&gt;> "' ORDER BY dateProgramStart";
>>;
>>;
>>; Regards, Dave S
>&gt;
>&gt; ----- Original Message -----
>>; From: "Moshe Tapnack&quot; < elists%40tapnack.com">eliststapnack.com>
&gt;> To: < ASP-Support-Group%40yahoogroups.com">ASP-Support-Groupyahoogroups.com>
>> Sent: Monday, February 19, 2007 3:16 PM
>&gt; Subject: RE: -=(ASP-Support-Group)=- asp/sql date issue
&gt;>
&gt;>
&gt;>> Thanks David and Tony,
&gt;>>
>>&gt; Unfortunately server setup is my weak side :(
>&gt;>
&gt;>> In the meantime, I have added the getdate() to the SQL string, which
&gt;>> seems
&gt;>> to have solved the issue for now. But varchars sounds like the long term
>;>> solution.
>>&gt;
>&gt;> Thanks again!
&gt;>> Moshe
&gt;>>
>>&gt;
>&gt;> -----Original Message-----
>&gt;> From: ASP-Support-Group%40yahoogroups.com">ASP-Support-Groupyahoogroups.com
&gt;>> [mailto: ASP-Support-Group%40yahoogroups.com">ASP-Support-Groupyahoogroups.com] On Behalf Of David Smart
&gt;>> Sent: Sunday, February 18, 2007 10:46 PM
>&gt;> To: ASP-Support-Group%40yahoogroups.com">ASP-Support-Groupyahoogroups.com
&gt;>> Subject: Re: -=(ASP-Support-Group)=- asp/sql date issue
&gt;>>
>>&gt; Databases notoriously do not handle "UK&quot; date format - this is probably
>>&gt; true
>;>>
>>&gt; of SQL Server too. Convert all dates to international format -
>&gt;> YYYY-MM-DD
>>> in SQL statements so there will be no ambiguity to computer or human.
&gt;>>
>>> You shouldn't have problems with that date format.
>>>;
>>;> The other alternative is to let the database engine supply the date
>>;> (i.e.
&gt;>> put the call to the date function inside the SQL string).
>>&gt;
>&gt;> Regards, Dave S
>&gt;>
&gt;>> ----- Original Message -----
>>;> From: "Moshe Tapnack&quot; < elists%40tapnack.com">eliststapnack.com>
&gt;>> To: < ASP-Support-Group%40yahoogroups.com">ASP-Support-Groupyahoogroups.com>
>>> Sent: Monday, February 19, 2007 3:34 AM
>&gt;> Subject: -=(ASP-Support-Group)=- asp/sql date issue
&gt;>>
>>&gt;
>&gt;>> hey folks
&gt;>>&gt;
>&gt;>> I have an ASP page, with an SQL Server 2000 backend.
>>&gt;> the DB has a collation of Hebrew_CI_AS
>&gt;>>
>>&gt;> when I request records as follows:
>>&gt;>
&gt;>>&gt; SELECT * FROM [tblSubLinks] WHERE Active = 1 AND (dateLeaveHome IS NOT
>>>>; NULL)
&gt;>>&gt; AND dateProgramStart > '" & now()-1 & "' ORDER BY dateProgramStart
&gt;>>&gt;
>&gt;>> I get the following error, when dateProgramStart = 27/02/07 12:00:00
>>;>> AM
>&gt;>> :
>&gt;>> The conversion of a char data type to a datetime data type resulted in
>&gt;>> an
>&gt;>> out-of-range datetime value.
&gt;>>>
>>>>; Which points to the spot where I am comparing to yesterday's date.
&gt;>>&gt;
>&gt;>> In SQL Management Studio, I see the dates as dd/mm/yyyy - as should be
>&gt;>> as
>&gt;>> defined (I think) by the Hebrew collation.
>>>>
>>>;> I have found, that when I manually change the page LCID to that of an
>&gt;>> american one (1033) - I do not get that error.
&gt;>>>
>>>>; but when i have the LCID as Hebrew (or UK), as i want it, i get the
>>>>; error
&gt;>>&gt; above.
&gt;>>>
>>>>; so the data in the DB seems like its in the correct format, but when
>;>>&gt; accessed with the relevant LCID from ASP, it errors. only with the
>>>>; American
>>&gt;> LCID (incorrect for this situation) - it errors.
>>>;>
>;>>&gt; any ideas???
>>&gt;>
&gt;>>&gt; Thanks!
>>>;> Moshe
&gt;>>&gt;
>&gt;>>
>>>>
>>>;>
>;>>&gt; Group homepage is here:
&gt;>>&gt; http://groups.yahoo.com/group/ASP-Support-Group
>>>;>
>;>>&gt; To unsubscribe from this group, send an email to:
>>>>; ASP-Support-Group-unsubscribe%40yahoogroups.com">ASP-Support-Group-unsubscribeyahoogroups.com and cross your
>>;>> fingers
>>>;> because Yahoo is 5h1te.
&gt;>>>
>>>>; Yahoo! Groups Links
&gt;>>&gt;
>&gt;>>
>>>>
>>>;
>>;>
>;>>
>>&gt; Group homepage is here:
&gt;>> http://groups.yahoo.com/group/ASP-Support-Group
>>>;
>>;> To unsubscribe from this group, send an email to:
>>> ASP-Support-Group-unsubscribe%40yahoogroups.com">ASP-Support-Group-unsubscribeyahoogroups.com and cross your fingers
>>>; because Yahoo is 5h1te.
&gt;>>
>>> Yahoo! Groups Links
&gt;>>
>>&gt;
>&gt;>
&gt;>>
>>>
>>>
>>>;
>>;> Group homepage is here:
&gt;>> http://groups.yahoo.com/group/ASP-Support-Group
>>>;
>>;> To unsubscribe from this group, send an email to:
>>> ASP-Support-Group-unsubscribe%40yahoogroups.com">ASP-Support-Group-unsubscribeyahoogroups.com and cross your fingers
>>>; because Yahoo is 5h1te.
&gt;>>
>>> Yahoo! Groups Links
&gt;>>
>>&gt;
>&gt;>
&gt;>
&gt;>
&gt;>
&gt;> Group homepage is here:
&gt;> http://groups.yahoo.com/group/ASP-Support-Group
>>
>> To unsubscribe from this group, send an email to:
>> ASP-Support-Group-unsubscribe%40yahoogroups.com">ASP-Support-Group-unsubscribeyahoogroups.com and cross your fingers
>> because Yahoo is 5h1te.
&gt;>
&gt;> Yahoo! Groups Links
&gt;>
&gt;>
&gt;>
&gt;>
&gt;
>
>
>;
> Group homepage is here:
&gt; http://groups.yahoo.com/group/ASP-Support-Group
>
> To unsubscribe from this group, send an email to:
> ASP-Support-Group-unsubscribe%40yahoogroups.com">ASP-Support-Group-unsubscribeyahoogroups.com and cross your fingers
> because Yahoo is 5h1te.
&gt;
> Yahoo! Groups Links
&gt;
>
>

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )