Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
LIKE - what's wrong
Message
From
28/04/2003 12:16:56
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
LIKE - what's wrong
Miscellaneous
Thread ID:
00782298
Message ID:
00782298
Views:
39
Hello All,
I have been in the BOL and the following should work according to all that I have read, however, sample #1 does not work and sample #2 does work, any idea why? Also, they do not have full-text indexing so I can't use CONTAINS. TIA.

Sample #1
DECLARE @EvaluationID int, @SearchString char(100)

SET @EvaluationID = 23
SET @SearchString = '%quest%'

SELECT DISTINCT( q.QuestionID ), 
	 q.QuestionText, 
	 d.html_description as AnswerDisplay
FROM Questions q 
INNER JOIN Types t ON q.QuestionTypeID = t.TypeID
		INNER JOIN DataGridCode d ON t.TypeID = d.TypeID
	WHERE q.QuestionText LIKE @SearchString
ORDER BY q.QuestionID
Sample #2
DECLARE @EvaluationID int, @SearchString char(100)
SET @EvaluationID = 23

SELECT DISTINCT( q.QuestionID ), 
	 q.QuestionText, 
	 d.html_description as AnswerDisplay
FROM Questions q 
	INNER JOIN Types t ON q.QuestionTypeID = t.TypeID
	INNER JOIN DataGridCode d ON t.TypeID = d.TypeID
WHERE q.QuestionText LIKE '%quest%'
ORDER BY q.QuestionID
Thank you,
Rhonda
Next
Reply
Map
View

Click here to load this message in the networking platform