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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 LIKE Statement Spacing A0 HEX

Author  Topic 

windminstreel
Starting Member

3 Posts

Posted - 2009-05-25 : 05:42:17
Hi,

I have a table (PricelistLines) ('Latin1_General_CI_AS' collation) with a Description field where there are ocassionaly spacings with a HEX code A0. When i try to do a LIKE Statement:

SELECT *
FROM PricelistLines
WHERE Description LIKE '%foo bar%'

There is no result because the spacing between "foo bar" isn't A0 hex, how can i resolve this.

Thanks in advance,

Chris

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-05-25 : 05:45:48
LIKE '%foo' + CHAR(160) + 'bar%'


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

windminstreel
Starting Member

3 Posts

Posted - 2009-05-25 : 05:48:00
I don't always know if the spacing is A0 HEX, does that matter?
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2009-05-25 : 05:52:52
like '%foo_bar%'
like '%foo[^a-zA-Z0-9]bar%'


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

windminstreel
Starting Member

3 Posts

Posted - 2009-05-25 : 05:57:33
Thanks nr the last one works for me
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2009-05-25 : 05:58:42
Watch out for puntuation or hyphens.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -