﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server 2008 - General  / Identifying ASCII characters in NVARCHAR columns / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sat, 18 May 2013 22:52:55 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Identifying ASCII characters in NVARCHAR columns</title><link>http://www.sqlservercentral.com/Forums/Topic927503-391-1.aspx</link><description>Thanks for the code Lowell, I have been playing around with this myself and it looks like it is going to work out well for my problem.Thanks again both of you for the help!</description><pubDate>Tue, 25 May 2010 10:00:28 GMT</pubDate><dc:creator>chrismalone1</dc:creator></item><item><title>RE: Identifying ASCII characters in NVARCHAR columns</title><link>http://www.sqlservercentral.com/Forums/Topic927503-391-1.aspx</link><description>proof of concept for Steve's idea;i thought that was kind of neat:[code]--results:Status cnv                            id          val     id          val------ ------------------------------ ----------- ------- ----------- -------Pass   Hello                          1           Hello   1           HelloPass   abc123                         2           abc123  2           abc123Fail   ???                            3           太平市     3           太平市Fail   abc?123                        4           abc太123 4           abc太123[/code]the test code:[code]SELECT 1 as id,N'Hello' As valINTo #TMP UNION ALLSELECT 2 as id,N'abc123' UNION ALLSELECT 3 as id,N'太平市'  UNION ALLSELECT 4 as id,N'abc太123'SELECT   CASE     WHEN t1.val = CONVERT(varchar,t2.val)     THEN 'Pass'     ELSE 'Fail'  END As Status,  CONVERT(varchar,t2.val) As cnv,* FROM #TMP t1  LEFT OUTER JOIN #TMP t2  ON t1.Id = t2.ID[/code]</description><pubDate>Tue, 25 May 2010 09:33:41 GMT</pubDate><dc:creator>Lowell</dc:creator></item><item><title>RE: Identifying ASCII characters in NVARCHAR columns</title><link>http://www.sqlservercentral.com/Forums/Topic927503-391-1.aspx</link><description>Thanks Steve, this may be an option if we cannot figure out a better way around this.  I just need to confirm that we are not allowing ? characters to exist in any of the strings I am cleansing and, if so, create some type of internal process for escaping these out so they do not trigger the 'international' flag.Appreciate the help.</description><pubDate>Tue, 25 May 2010 09:19:37 GMT</pubDate><dc:creator>chrismalone1</dc:creator></item><item><title>RE: Identifying ASCII characters in NVARCHAR columns</title><link>http://www.sqlservercentral.com/Forums/Topic927503-391-1.aspx</link><description>I know CAST will allow you to change it to a VARCHAR, and you'll end up with a variety of ? in the items for non-ASCII characters.Perhaps you can somehow search for those placeholders and if they aren't there (CHARINDEX=0), you can do your processing?</description><pubDate>Tue, 25 May 2010 08:50:46 GMT</pubDate><dc:creator>Steve Jones - SSC Editor</dc:creator></item><item><title>Identifying ASCII characters in NVARCHAR columns</title><link>http://www.sqlservercentral.com/Forums/Topic927503-391-1.aspx</link><description>Hello,I have an issue where I am storing various international characters in nvarchar columns, but need to branch the data at one point of processing so that ASCII characters are run through an additional cleansing process and all non-ASCII characters are set aside.Is there a way to identify which nvarchar values are within the ASCII range and can be converted to varchar without corruption?  Also, the strings may contain a mix of english and international character sets, so the entire string must be checked and not just the first character.i.e.Pass:'Hello', 'abc123'Fail:'太平市', 'abc太123'Any help would be appreciated and let me know if examples would make this more clear.Regards,Chris</description><pubDate>Tue, 25 May 2010 08:25:01 GMT</pubDate><dc:creator>chrismalone1</dc:creator></item></channel></rss>