Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
bulubuk1976
Starting Member
24 Posts |
Posted - 2008-03-10 : 05:31:37
|
I am using SQL 2000 and I am not getting the right results to my query. I want to do a query that looks or a certain word in a varchar of more than 2000 characters. Here's my code:SELECT *FROM EmployeesWhere JobDescription1 Like '%monthly'It does pull up records with the word monthly and also pulls a record with empty field which, I am trying to figure out what the code should be.Thanks for the help and more power! |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-03-10 : 05:35:46
|
Your query above only pulls the records what ENDS with the text "monthly". E 12°55'05.25"N 56°04'39.16" |
 |
|
bulubuk1976
Starting Member
24 Posts |
Posted - 2008-03-10 : 05:48:07
|
quote: Originally posted by Peso Your query above only pulls the records what ENDS with the text "monthly". E 12°55'05.25"N 56°04'39.16"
Sorry I mistyped it. Here is the actual code that I am using but still includes Names with blank JobDescription1 in the results. Any Ideas?SELECT Name, JobDescription1FROM EmployeesWhere JobDescription1 Like '%monthly%' |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-03-10 : 06:18:27
|
Blank (empty space), or NULL? E 12°55'05.25"N 56°04'39.16" |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-03-10 : 06:19:48
|
[code]DECLARE @Sample TABLE (d VARCHAR(200))INSERT @SampleSELECT '' UNION ALL -- Empty spaceSELECT NULL UNION ALL -- NULLSELECT 'Bimonthly report' -- Actual textSELECT *FROM @SampleWHERE d LIKE '%monthly%'[/code] E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|