Groups | Blog | Home
all groups > sql server data mining > march 2004 >

sql server data mining : SQL script fails to execute


Adam Machanic
3/5/2004 10:56:39 AM
You have a space before "John" and after "Smith" in your "John Smith"
string - ' John Smith '. That will not evaluate to be equivalent with 'John
Smith'; I assume you don't have spaces before every first name and after
every last name in your database?

[quoted text, click to view]

Stuart
3/5/2004 3:32:24 PM
I've written the following SQL script which the Query Analyzer, that came
with our SQL Server 2000, has confirmed as OK. However, when I attempt to
run the script nothing is returned.

I'm very new to SQL, so this may be a simple user error, but I would really
appreciate some help,

Thanks

SELECT JobTypes.JobType_code AS [.], tblEnquiries.Job_ID AS [Job No],
tblEnquiries.lngEnquiryID AS [Enq No], tblEnquiries.strProjectName AS
[Project Name],
CASE
WHEN tblEnquiries.strAttentionOf = '0' THEN 'X'
ELSE NULL
END AS Contact
FROM tblEnquiries INNER JOIN
tblEmployees ON tblEnquiries.strProjectMan =
tblEmployees.lngEmployeeID INNER JOIN
JobTypes ON tblEnquiries.Job_Type_ID = JobTypes.JobType_ID
WHERE (tblEmployees.strEmployeeFName + N' ' +
tblEmployees.strEmployeeSName = N' John Smith ')
ORDER BY tblEnquiries.Job_ID, tblEnquiries.lngEnquiryID

AddThis Social Bookmark Button