Ask a Question related to ASP Database, Design and Development.
-
TomT #1
SQL Statement BETWEEN 2 Dates - Advice Please.
strList = "select * " _
& "from tbltest "_
& "WHERE user LIKE '%" & Replace(strSearch, "'", "''") & "%' AND ID < '2'
"_
& "AND IDate Between #01/08/2004# AND #09/08/2004# " _
& "order by CDATE(IDate)"
This works but it shows all dates not just the ones between the 2 dates...
The access MDB has the 'IDate' formated as Date/Time.
How do I correct this ??
Thanks
TomT Guest
-
ASP/VBS Dates Between Dates
I'm trying to filter records depending on 2 dates requested from the querystring MMColParam1 (startdate) and MMColParam2 (enddate), i.e. a list... -
Dates again
Hello all I'm having trouble getting iis to understand the UK format of dates ASP off a MS Access database I have the following query:... -
Advice on dates (not the lonely hearts ones)
Hi All Have a couple of quandaries that I was wondering if you could assist on: 1) Created a page whereby the user selects the day, month and... -
Need an advice on 'declare cursor' statement
Hi all I run next declare cursor statement: declare c1 cursor for select date_modified, event_modified_cd, rec_id from physicalsecurity... -
Help with Dates please
Hi, In a SQL table I have a field named departure and a date in inserted in it. What is the exact syntax to get only records with a future date... -
Aaron [SQL Server MVP] #2
Re: SQL Statement BETWEEN 2 Dates - Advice Please.
Stop using ambiguous date formats! I can't tell if you mean January 8th or
August 1st, how do you expect the software to know?
WHERE IDate >= #2004-08-01# AND IDate < #2004-08-10#
--
[url]http://www.aspfaq.com/[/url]
(Reverse address to reply.)
"TomT" <tomt@adslweb.co.uk> wrote in message
news:411a7a83$0$20243$cc9e4d1f@news-text.dial.pipex.com...'2'> strList = "select * " _
> & "from tbltest "_
> & "WHERE user LIKE '%" & Replace(strSearch, "'", "''") & "%' AND ID <dates...> "_
> & "AND IDate Between #01/08/2004# AND #09/08/2004# " _
> & "order by CDATE(IDate)"
>
> This works but it shows all dates not just the ones between the 2>
> The access MDB has the 'IDate' formated as Date/Time.
>
> How do I correct this ??
>
> Thanks
>
>
Aaron [SQL Server MVP] Guest
-
TomT #3
Re: SQL Statement BETWEEN 2 Dates - Advice Please.
> Stop using ambiguous date formats! I can't tell if you mean January 8th
orHi,> August 1st, how do you expect the software to know?
>
> WHERE IDate >= #2004-08-01# AND IDate < #2004-08-10#
I thought 01/08/2004 was a valid date format ??
Anyway... Changing the SQL Statement to the below and now it seems to be
working !!
WHERE IDate >= #2004-08-01# AND IDate <= #2004-08-10#
Cheers
TomT Guest
-
Raymond D'Anjou \(raydan\) #4
Re: SQL Statement BETWEEN 2 Dates - Advice Please.
SELECT CAST('STARDATE 34523.2' AS DATETIME)
Works for me.... \\//
"Aaron [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
news:urZAxL%23fEHA.1196@TK2MSFTNGP11.phx.gbl...>> > I thought 01/08/2004 was a valid date format ??
> Depends on what country you are in, what country the server is in, what
> language/regional settings have been applied on the server, the
> language/locale of the application (in this case Access), the application
> code, and the user.
>
> With YYYY-MM-DD, nobody can be confused, unless they are expecting a
> stardate.
>
> (With SQL Server, you use YYYYMMDD, not YYYY-MM-DD.)
>
> --
> [url]http://www.aspfaq.com/[/url]
> (Reverse address to reply.)
>
>
Raymond D'Anjou \(raydan\) Guest
-
Aaron [SQL Server MVP] #5
Re: SQL Statement BETWEEN 2 Dates - Advice Please.
> I thought 01/08/2004 was a valid date format ??
Depends on what country you are in, what country the server is in, what
language/regional settings have been applied on the server, the
language/locale of the application (in this case Access), the application
code, and the user.
With YYYY-MM-DD, nobody can be confused, unless they are expecting a
stardate.
(With SQL Server, you use YYYYMMDD, not YYYY-MM-DD.)
--
[url]http://www.aspfaq.com/[/url]
(Reverse address to reply.)
Aaron [SQL Server MVP] Guest
-
Raymond D'Anjou \(raydan\) #6
Re: SQL Statement BETWEEN 2 Dates - Advice Please.
Just changing the statement to:
SELECT CAST(34523.2 AS DATETIME)
does return a date.
Do you think that the old StarTrek show used SQL to generate star dates???
How did you like my \\//
It's suppose to represent Spock's hand greeting.
"Aaron [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
news:e1pUhU%23fEHA.3272@TK2MSFTNGP11.phx.gbl...>> > SELECT CAST('STARDATE 34523.2' AS DATETIME)
> >
> > Works for me.... \\//
> Wow, you must have been given advance access to the Spock patch. It was
> promised to me, but I haven't seen it yet. ;-)
>
> --
> [url]http://www.aspfaq.com/[/url]
> (Reverse address to reply.)
>
>
Raymond D'Anjou \(raydan\) Guest
-
Aaron [SQL Server MVP] #7
Re: SQL Statement BETWEEN 2 Dates - Advice Please.
> SELECT CAST('STARDATE 34523.2' AS DATETIME)
Wow, you must have been given advance access to the Spock patch. It was>
> Works for me.... \\//
promised to me, but I haven't seen it yet. ;-)
--
[url]http://www.aspfaq.com/[/url]
(Reverse address to reply.)
Aaron [SQL Server MVP] Guest
-
Bob Barrows [MVP] #8
Re: SQL Statement BETWEEN 2 Dates - Advice Please.
1. That has nothing to do with Access, which does not support CAST
2. It has nothing to do with the point that Aaron was making
Raymond D'Anjou (raydan) wrote:--> SELECT CAST('STARDATE 34523.2' AS DATETIME)
>
> Works for me.... \\//
>
> "Aaron [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
> news:urZAxL%23fEHA.1196@TK2MSFTNGP11.phx.gbl...>>>>> I thought 01/08/2004 was a valid date format ??
>> Depends on what country you are in, what country the server is in,
>> what language/regional settings have been applied on the server, the
>> language/locale of the application (in this case Access), the
>> application code, and the user.
>>
>> With YYYY-MM-DD, nobody can be confused, unless they are expecting a
>> stardate.
>>
>> (With SQL Server, you use YYYYMMDD, not YYYY-MM-DD.)
>>
>> --
>> [url]http://www.aspfaq.com/[/url]
>> (Reverse address to reply.)
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob Barrows [MVP] Guest
-
TomT #9
Re: SQL Statement BETWEEN 2 Dates - Advice Please.
Well thats confused the hell out of me... :)
Beam me up Scotty !!
"Raymond D'Anjou (raydan)" <rdanjou@savantsoft.nonospamcom> wrote in message
news:eUFCia%23fEHA.3932@TK2MSFTNGP09.phx.gbl...> Just changing the statement to:
> SELECT CAST(34523.2 AS DATETIME)
> does return a date.
>
> Do you think that the old StarTrek show used SQL to generate star dates???
>
> How did you like my \\//
> It's suppose to represent Spock's hand greeting.
>
> "Aaron [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
> news:e1pUhU%23fEHA.3272@TK2MSFTNGP11.phx.gbl...>> >> > > SELECT CAST('STARDATE 34523.2' AS DATETIME)
> > >
> > > Works for me.... \\//
> > Wow, you must have been given advance access to the Spock patch. It was
> > promised to me, but I haven't seen it yet. ;-)
> >
> > --
> > [url]http://www.aspfaq.com/[/url]
> > (Reverse address to reply.)
> >
> >
>
TomT Guest
-
Raymond D'Anjou \(raydan\) #10
Re: SQL Statement BETWEEN 2 Dates - Advice Please.
True.
I subscribe to sqlserver.programming too, don't know much Access so I can't
really tell what doesn't work.
Humble appologies.
Besides that, I was just having a bit of fun and forgot to put a :-) at the
end of the post.
"Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
news:%23Gy6Ab%23fEHA.3988@tk2msftngp13.phx.gbl...> 1. That has nothing to do with Access, which does not support CAST
> 2. It has nothing to do with the point that Aaron was making
>
> Raymond D'Anjou (raydan) wrote:>> > SELECT CAST('STARDATE 34523.2' AS DATETIME)
> >
> > Works for me.... \\//
> >
> > "Aaron [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
> > news:urZAxL%23fEHA.1196@TK2MSFTNGP11.phx.gbl...> >>> I thought 01/08/2004 was a valid date format ??
> >>
> >> Depends on what country you are in, what country the server is in,
> >> what language/regional settings have been applied on the server, the
> >> language/locale of the application (in this case Access), the
> >> application code, and the user.
> >>
> >> With YYYY-MM-DD, nobody can be confused, unless they are expecting a
> >> stardate.
> >>
> >> (With SQL Server, you use YYYYMMDD, not YYYY-MM-DD.)
> >>
> >> --
> >> [url]http://www.aspfaq.com/[/url]
> >> (Reverse address to reply.)
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
Raymond D'Anjou \(raydan\) Guest
-
Bob Barrows [MVP] #11
Re: SQL Statement BETWEEN 2 Dates - Advice Please.
Raymond D'Anjou (raydan) wrote:
Yeah, I missed that - I thought there was a typo. Need to adjust my humor> True.
> I subscribe to sqlserver.programming too, don't know much Access so I
> can't really tell what doesn't work.
> Humble appologies.
> Besides that, I was just having a bit of fun and forgot to put a :-)
> at the end of the post.
index :-)
Bob
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob Barrows [MVP] Guest
-
Raymond D'Anjou \(raydan\) #12
Re: SQL Statement BETWEEN 2 Dates - Advice Please.
I was starting to worry about you Bob.
Must be that [MVP] title.
When you get that it's "No more fun and games". ;-)
"Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
news:%23hgToZHgEHA.3928@TK2MSFTNGP11.phx.gbl...> Yeah, I missed that - I thought there was a typo. Need to adjust my humor
> index :-)
>
> Bob
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
Raymond D'Anjou \(raydan\) Guest
-
Aaron [SQL Server MVP] #13
Re: SQL Statement BETWEEN 2 Dates - Advice Please.
> Yeah, I missed that - I thought there was a typo. Need to adjust my humor
I think this will fix the problem:> index :-)
DROP INDEX Bob.ix_Humor
GO
CREATE /* important part here that was missing -> */
CLUSTERED UNIQUE /* end important part */
INDEX ix_Humor ON Bob(Humor, Sarcasm, Wit)
GO
--
[url]http://www.aspfaq.com/[/url]
(Reverse address to reply.)
Aaron [SQL Server MVP] Guest
-
Raymond D'Anjou \(raydan\) #14
Re: SQL Statement BETWEEN 2 Dates - Advice Please.
LOL.
I guess Aaron is out to prove that he has it and Bob don't.
"Aaron [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
news:O%23dpAwHgEHA.704@TK2MSFTNGP09.phx.gbl...humor> > Yeah, I missed that - I thought there was a typo. Need to adjust my>> > index :-)
> I think this will fix the problem:
>
> DROP INDEX Bob.ix_Humor
> GO
>
> CREATE /* important part here that was missing -> */
> CLUSTERED UNIQUE /* end important part */
> INDEX ix_Humor ON Bob(Humor, Sarcasm, Wit)
> GO
>
> --
> [url]http://www.aspfaq.com/[/url]
> (Reverse address to reply.)
>
>
Raymond D'Anjou \(raydan\) Guest
-
Bob Barrows [MVP] #15
Re: SQL Statement BETWEEN 2 Dates - Advice Please.
Aaron [SQL Server MVP] wrote:
Don't forget the fillfactor. ;-)>>> Yeah, I missed that - I thought there was a typo. Need to adjust my
>> humor index :-)
> I think this will fix the problem:
>
> DROP INDEX Bob.ix_Humor
> GO
>
> CREATE /* important part here that was missing -> */
> CLUSTERED UNIQUE /* end important part */
> INDEX ix_Humor ON Bob(Humor, Sarcasm, Wit)
> GO
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob Barrows [MVP] Guest



Reply With Quote

