View Single Post

   
  #2 (permalink)  
Old 03-01-2008, 02:46 PM
Erland Sommarskog
 
Posts: n/a
Default Re: Find all chars in table that are ASCII code 128 and Greater

DennBen (dbenedett@hotmail.com) writes:
> Does anyone know how to query a field in a table where it contains an
> ASCII code >= 128 - without looping through every field for every
> record in table (using charindex)?
>
> Ex of char I would like to find: ü which is char(252)


select *
from tbl
where col COLLATE Latin1_General_BIN
LIKE '%[^' + char(32) + '-' + char(126) + ']%'

If you want to run this for many in columns in many tables, you
will to run the query once per column and table.

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Reply With Quote