|
-
Sep 9th, 2002, 05:26 AM
#1
Thread Starter
Addicted Member
SQL Query problem
Hi
I have a date field in my sql 2000 DB called "dttripstart" It the following value:"2000-11-22 06:39:49.000" I am trying to do a select statement where dttripstart = '2000-11-22 ' How do I specify this?
Thanking you in advance
PORRASTAR
-
Sep 9th, 2002, 05:34 AM
#2
Member
Sql Date
Because u have allowed times in the field then u will have to use one of the following methods
These are part of the where clause :-
dttripstart >= #22/Nov/2000# And dttripstart <#23/Nov/2000#
or
cdate(format(dttripstart,'dd/mmm/yyyy')) = #22/Nov/2000#
-
Sep 9th, 2002, 05:45 AM
#3
Thread Starter
Addicted Member
If i use the following query: select * from tripdata where dttripstart >= #22/Nov/2000# And dttripstart <#23/Nov/2000#
I get the following error:
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '#'.
If I use the following query:select * from tripdata where cdate(format(dttripstart,'dd/mmm/yyyy')) = #22/Nov/2000#
Then I get the following error:Server: Msg 195, Level 15, State 10, Line 1
'format' is not a recognized function name.
Any idea as to what is wrong?
-
Sep 9th, 2002, 05:53 AM
#4
Frenzied Member
First error is because you have to put a space after the < sign in <#23/Nov/2000#
the second one because the format is to be done on vb's side
"select * from tripdata where " & cdate(format(dttripstart,"dd/mmm/yyyy")) & " = #22/Nov/2000#"
Code:
If Question = Incomplete Then
AnswerNextOne
Else
ReplyIfKnown
End If
cu Swatty
-
Sep 9th, 2002, 05:55 AM
#5
Member
Sorry Using MSA97
Try following:-
SELECT tripdata.*
FROM tripdata
WHERE (((tripdata.dttripstart)>=#11/22/2000# And (tripdata.dttripstart)<#11/23/2000#));
MS2000 may not allow format
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|