home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 17,689 of 19,505   
   Erland Sommarskog to HumanJHawkins   
   Re: How to Find Extended Characters in T   
   12 Nov 09 11:28:25   
   
   4342e8cc   
   From: esquel@sommarskog.se   
      
   HumanJHawkins (JHawkins@Locutius.Com) writes:   
   > I need to find records where a text (and/or varchar) field contains   
   > extended characters. If I knew particular extended characters, I could   
   > do something like this:   
   >    select * from TableName where charindex('-',vchitem)<>0 or charindex   
   > ('',vchitem)<>0   
   >   
   > But I do not know what extended characters might be in the field, so I   
   > need to do something like looking for text that contains an ASCII   
   > value greater than 127 for example.   
   >   
   > Can anyone think of how to do this?   
      
   patindex('%[' + char(127) + '-' + char(255) + ']%',   
             col COLLATE Latin1_General_BIN2)   
      
   That is, by forcing a binary collection, you can use a range pattern.   
      
      
   --   
   Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se   
      
   Books Online for SQL Server 2005 at   
   http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx   
   Books Online for SQL Server 2000 at   
   http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca