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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Query problem

Status
Not open for further replies.

timwilliams77

IS-IT--Management
Jul 9, 2007
19
GB
Hi

I have wrote the following query but i get the error "Syntax error converting datetime from character string."


use itrisdb1
select employees.user_name, companies.name, cvssent.date_sent, requirements.job_title, interviews.date_time, applicants.first_name, applicants.last_name, applicants.post_code, interviews.num, apprelinfo.num_marketed_cvs, apprelinfo.num_cvsent
from employees, cvssent, requirements, interviews, companies, applicants, apprelinfo
where employees.user_name != companies.name
and cvssent.date_sent != requirements.job_title
and interviews.date_time != applicants.first_name
and applicants.last_name != applicants.post_code
and interviews.num != apprelinfo.num_marketed_cvs
and cvssent.date_sent > '01/06/2007'
order by employees.user_name asc

Can anyone please help?

Tim
 
i bet it's this --
Code:
and cvssent.date_sent != requirements.job_title

when would the date sent ever equal the job title???

:)


r937.com | rudy.ca
 
If the date you want is 01 June 2007 try:
Code:
and cvssent.date_sent > CAST('20070601' as DateTime)

If it is 06 Jan:

Code:
and cvssent.date_sent > CAST('20070106' as DateTime)

or better use a variable:
Code:
DECLARE @dtIWant satetime
SET @dtIWant = CAST('20070601' as DateTime)

....
and cvssent.date_sent > @dtIWant

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
MVP VFP
 
hi guys

i have tried both the above and the query runs but it is still running now

it is too big as it is across different tables and has a lot of data,

how can i speed it up?

Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top