Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL question (dates)

Status
Not open for further replies.

shannanl

IS-IT--Management
Apr 24, 2003
1,071
US
I have been using Access and now I am migrating to SQL Server 7.0. Using Access I can query a table like this:

"SELECT * FROM table WHERE workdate = #" & dteDate & "# "

This works fine in Access but does not in SQL server. I can't seem to get any format to work. I notice in the Query Analyzer that the workdate field includes the date and time (the time listed as something like 00:00:00:00. I am using date/time format for the field. Can anyone suggest the correct syntax for a date query of SQL server?

Thanks in advance,

Shannan
 
Replace the hash (#) with apostrophe (') both sides of the date for a start

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
The # is Access only, you'd use regular quotes in SQL Server. In addition, check Books Online for the CONVERT function which you may find necessary when working with dates in another format than the standard (I, for instance, have to use this constantly because I use a European format that starts with the day rather than the month).


"Much that I bound, I could not free. Much that I freed returned to me."
(Lee Wilson Dodd)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top