<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><title type="html">Collation, DateTime, SParse Column and XML</title><subtitle type="html" /><id>http://blogs.msdn.com/qingsongyao/atom.xml</id><link rel="alternate" type="text/html" href="http://blogs.msdn.com/qingsongyao/default.aspx" /><link rel="self" type="application/atom+xml" href="http://blogs.msdn.com/qingsongyao/atom.xml" /><generator uri="http://communityserver.org" version="2.1.61025.2">Community Server</generator><updated>2009-02-13T06:32:00Z</updated><entry><title>Query on Float DataType may return inconsistent result</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/qingsongyao/archive/2009/11/14/float-datatype-is-evil.aspx" /><id>http://blogs.msdn.com/qingsongyao/archive/2009/11/14/float-datatype-is-evil.aspx</id><published>2009-11-14T19:27:19Z</published><updated>2009-11-14T19:27:19Z</updated><content type="html">Let us try following T-SQL script on SQL Server: declare @a float =300000000000000000000000000000000000 select @a + 50 -@a select @a -@a +50 go Guess what is the result? the first is 0 . and the second result is 50 . Floating point data is approximate; therefore, not all values in the data type range can be represented exactly. When you add a small number with a very big number, the small number might just lost in the end result. As a end-user, we want consistent and correct result. However, float...(&lt;a href="http://blogs.msdn.com/qingsongyao/archive/2009/11/14/float-datatype-is-evil.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9922514" width="1" height="1"&gt;</content><author><name>Qingsong Yao</name><uri>http://blogs.msdn.com/members/Qingsong+Yao.aspx</uri></author></entry><entry><title>Tertiary Collation and the performance impact on order clause</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/qingsongyao/archive/2009/11/14/tertiary-collation-and-the-performance-impact-on-order-clause.aspx" /><id>http://blogs.msdn.com/qingsongyao/archive/2009/11/14/tertiary-collation-and-the-performance-impact-on-order-clause.aspx</id><published>2009-11-14T19:04:26Z</published><updated>2009-11-14T19:04:26Z</updated><content type="html">Today, One customer asked about collation SQL_Latin1_General_CP1_CI_AI with non unique nonclustered index we are getting a sort on the query plan. The sample script is: CREATE TABLE TableWithASColumn(ID INT PRIMARY KEY, CharData VARCHAR(100) COLLATE SQL_Latin1_General_CP1_CI_AS) CREATE NONCLUSTERED INDEX IX_CharData ON TableWithASColumn(CharData) CREATE TABLE TableWithAIColumn(ID INT PRIMARY KEY,CharData VARCHAR(100) COLLATE SQL_Latin1_General_CP1_CI_AI) CREATE NONCLUSTERED INDEX IX_CharData ON TableWithAIColumn(CharData)...(&lt;a href="http://blogs.msdn.com/qingsongyao/archive/2009/11/14/tertiary-collation-and-the-performance-impact-on-order-clause.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9922510" width="1" height="1"&gt;</content><author><name>Qingsong Yao</name><uri>http://blogs.msdn.com/members/Qingsong+Yao.aspx</uri></author></entry><entry><title>How to make Like Case Sensitive?</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/qingsongyao/archive/2009/09/18/how-to-make-like-case-sensitive.aspx" /><id>http://blogs.msdn.com/qingsongyao/archive/2009/09/18/how-to-make-like-case-sensitive.aspx</id><published>2009-09-18T07:13:34Z</published><updated>2009-09-18T07:13:34Z</updated><content type="html">Today, I got a question from customer: I have one column (Type: nVarchar) in a table which has data something like this: a1 aa aa2 AB I want to show all the rows which have all the lower case letters in the above mentioned column. The following query works: select * from test WHERE LTRIM(RTRIM(a)) LIKE '%[abc]%' Collate Latin1_General_CS_AI And Surprisingly this one does not: select * from test WHERE LTRIM(RTRIM(a)) LIKE '%[a-c]%' Collate Latin1_General_CS_AI --Would actually be [a-z] Is it like...(&lt;a href="http://blogs.msdn.com/qingsongyao/archive/2009/09/18/how-to-make-like-case-sensitive.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9896647" width="1" height="1"&gt;</content><author><name>Qingsong Yao</name><uri>http://blogs.msdn.com/members/Qingsong+Yao.aspx</uri></author></entry><entry><title>Unicode References</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/qingsongyao/archive/2009/05/20/unicode-references.aspx" /><id>http://blogs.msdn.com/qingsongyao/archive/2009/05/20/unicode-references.aspx</id><published>2009-05-20T08:00:50Z</published><updated>2009-05-20T08:00:50Z</updated><content type="html">In this article, I recommend several Unicode articles/websites for reference. Note, the list is not yet completed, I will add more entries and make better categorization My blog is a good site for collation issues in SQL Server. Sort it all out . Michael Kaplan's random stuff of dubious value is a great source for learning Globalization techniques with Microsoft Software. International Features in Microsoft SQL Server 2005 . The title says. Description of storing UTF-8 data in SQL Server : this is...(&lt;a href="http://blogs.msdn.com/qingsongyao/archive/2009/05/20/unicode-references.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9631444" width="1" height="1"&gt;</content><author><name>Qingsong Yao</name><uri>http://blogs.msdn.com/members/Qingsong+Yao.aspx</uri></author><category term="surrogate" scheme="http://blogs.msdn.com/qingsongyao/archive/tags/surrogate/default.aspx" /><category term="collation" scheme="http://blogs.msdn.com/qingsongyao/archive/tags/collation/default.aspx" /></entry><entry><title>Beta version of collation selecting tool availiable </title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/qingsongyao/archive/2009/04/11/beta-version-of-collation-selecting-tool-availiable.aspx" /><link rel="enclosure" type="application/x-zip-compressed" length="107056" href="http://blogs.msdn.com/qingsongyao/attachment/9544242.ashx" /><id>http://blogs.msdn.com/qingsongyao/archive/2009/04/11/beta-version-of-collation-selecting-tool-availiable.aspx</id><published>2009-04-11T02:04:00Z</published><updated>2009-04-11T02:04:00Z</updated><content type="html">Hello, Guys Please the attached zip file for the SQL Server collation selection tool. It is written in C#....(&lt;a href="http://blogs.msdn.com/qingsongyao/archive/2009/04/11/beta-version-of-collation-selecting-tool-availiable.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9544242" width="1" height="1"&gt;</content><author><name>Qingsong Yao</name><uri>http://blogs.msdn.com/members/Qingsong+Yao.aspx</uri></author></entry><entry><title>SQL Server and UTF-8 Encoding (1) -True or False</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/qingsongyao/archive/2009/04/10/sql-server-and-utf-8-encoding-1-true-or-false.aspx" /><id>http://blogs.msdn.com/qingsongyao/archive/2009/04/10/sql-server-and-utf-8-encoding-1-true-or-false.aspx</id><published>2009-04-10T08:44:00Z</published><updated>2009-04-10T08:44:00Z</updated><content type="html">Today, I will start my series of articles about SQL Server and Unicode UTF-8 Encoding. In many times, I found when people ask me about UTF-8, they actually don't understand UTF-8. So today's talk will be quite short. I just clarify some misunderstand. 1. SQL Server doesn't support Unicode, do you mean UTF-8? Sometime, people just say "SQL Server doesn't support Unicode". Actually, it is wrong, SQL Server support Unicode since SQL Server 7.0 by providing nchar/nvarchar/ntext data type. But SQL Server...(&lt;a href="http://blogs.msdn.com/qingsongyao/archive/2009/04/10/sql-server-and-utf-8-encoding-1-true-or-false.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9542491" width="1" height="1"&gt;</content><author><name>Qingsong Yao</name><uri>http://blogs.msdn.com/members/Qingsong+Yao.aspx</uri></author><category term="surrogate" scheme="http://blogs.msdn.com/qingsongyao/archive/tags/surrogate/default.aspx" /><category term="collation" scheme="http://blogs.msdn.com/qingsongyao/archive/tags/collation/default.aspx" /></entry><entry><title>What I was doing these days?</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/qingsongyao/archive/2009/04/07/what-i-was-doing-these-days.aspx" /><id>http://blogs.msdn.com/qingsongyao/archive/2009/04/07/what-i-was-doing-these-days.aspx</id><published>2009-04-07T08:28:00Z</published><updated>2009-04-07T08:28:00Z</updated><content type="html">In recent days, I am mainly reading test books since I am a Tester, and I need to know more about testing. The good news for people who are interesting in collation topic is that I will have a SQL Server collation select tool available soon. I hope I can start to write UTF-8 related stuff. So if you are interesting in the above topic, and want to get more information soon. Please ping me by adding comments....(&lt;a href="http://blogs.msdn.com/qingsongyao/archive/2009/04/07/what-i-was-doing-these-days.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9535312" width="1" height="1"&gt;</content><author><name>Qingsong Yao</name><uri>http://blogs.msdn.com/members/Qingsong+Yao.aspx</uri></author><category term="collation" scheme="http://blogs.msdn.com/qingsongyao/archive/tags/collation/default.aspx" /></entry><entry><title>SQL Server’s Binary Collations</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/qingsongyao/archive/2009/04/07/sql-server-s-binary-collations.aspx" /><id>http://blogs.msdn.com/qingsongyao/archive/2009/04/07/sql-server-s-binary-collations.aspx</id><published>2009-04-07T06:55:00Z</published><updated>2009-04-07T06:55:00Z</updated><content type="html">Today, I will discuss SQL Server’s Binary collations. In SQL Server, we have two kinds of binary collations: BIN collation, which has collation name ending with _BIN and BIN2 collation, which has collation name ending with _BIN2. In SQL Server, a string value (either varchar or nvarchar value) is encoded and stored as a sequence of binaries. For nvarchar value, we always use the UCS-2 encoding. For varchar value, we use the codepage of corresponding collation associated with the value. For “Binary”...(&lt;a href="http://blogs.msdn.com/qingsongyao/archive/2009/04/07/sql-server-s-binary-collations.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9535265" width="1" height="1"&gt;</content><author><name>Qingsong Yao</name><uri>http://blogs.msdn.com/members/Qingsong+Yao.aspx</uri></author><category term="collation" scheme="http://blogs.msdn.com/qingsongyao/archive/tags/collation/default.aspx" /></entry><entry><title>Be aware of comparing unicode constant with varchar column (updated)</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/qingsongyao/archive/2009/03/26/be-aware-of-comparing-unicode-constant-with-varchar-column.aspx" /><id>http://blogs.msdn.com/qingsongyao/archive/2009/03/26/be-aware-of-comparing-unicode-constant-with-varchar-column.aspx</id><published>2009-03-26T07:27:00Z</published><updated>2009-03-26T07:27:00Z</updated><content type="html">Today, I looked for SQL Server JDBC Driver's sendStringParametersAsUnicode, this parameter controls how Unicode String (Java only have Unicode string which is UTF-16 encoding) will be sending to SQL Server. As the name of this parameter indicate, when the parameter equals to true, which is the default setting, we always send unicode data, i.e., the string with UTF-16 encoding, to SQL Server. When it is set to false, it also send ANSI data, i.e., the string encoded with a code page to SQL Server....(&lt;a href="http://blogs.msdn.com/qingsongyao/archive/2009/03/26/be-aware-of-comparing-unicode-constant-with-varchar-column.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9509671" width="1" height="1"&gt;</content><author><name>Qingsong Yao</name><uri>http://blogs.msdn.com/members/Qingsong+Yao.aspx</uri></author><category term="surrogate" scheme="http://blogs.msdn.com/qingsongyao/archive/tags/surrogate/default.aspx" /><category term="collation" scheme="http://blogs.msdn.com/qingsongyao/archive/tags/collation/default.aspx" /></entry><entry><title>Is Datetime2 compliant with Daylight Savings Time?</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/qingsongyao/archive/2009/03/12/is-datetime2-compliant-with-daylight-savings-time.aspx" /><id>http://blogs.msdn.com/qingsongyao/archive/2009/03/12/is-datetime2-compliant-with-daylight-savings-time.aspx</id><published>2009-03-12T08:08:00Z</published><updated>2009-03-12T08:08:00Z</updated><content type="html">Today, I got following questions: " The documentation states that Datetime2 is unaware of the time zone. Does that still guarantee that when the clock gets adjusted for Daylight Saving Time this will not result in duplicate timestamps? I.e. is Datetime2 internally mapped to UTC? " Here is the answer: Datetime2 does not guarantee that you will get a unique value you would have to have a unique constraint on the column. If you have several batches running at the exact same time on a multiprocessor...(&lt;a href="http://blogs.msdn.com/qingsongyao/archive/2009/03/12/is-datetime2-compliant-with-daylight-savings-time.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9471333" width="1" height="1"&gt;</content><author><name>Qingsong Yao</name><uri>http://blogs.msdn.com/members/Qingsong+Yao.aspx</uri></author></entry><entry><title>Why I write so many collation topics?</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/qingsongyao/archive/2009/03/11/why-i-write-so-many-collation-topics.aspx" /><id>http://blogs.msdn.com/qingsongyao/archive/2009/03/11/why-i-write-so-many-collation-topics.aspx</id><published>2009-03-11T08:10:00Z</published><updated>2009-03-11T08:10:00Z</updated><content type="html">You may wonder why I keep writing collation topics in my blogs. I found our Books Online topics related to collation is not so clearly enough, and sometime it confuse our reader. I intend to present my idea related to collation in a series of blogs, and finally I want group all these topics together to draw a clear picture about collation. My blogs will try to answer following question in details: How I should choose a collation? What is the different between collation A and B? How collation impact...(&lt;a href="http://blogs.msdn.com/qingsongyao/archive/2009/03/11/why-i-write-so-many-collation-topics.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9470106" width="1" height="1"&gt;</content><author><name>Qingsong Yao</name><uri>http://blogs.msdn.com/members/Qingsong+Yao.aspx</uri></author><category term="collation" scheme="http://blogs.msdn.com/qingsongyao/archive/tags/collation/default.aspx" /></entry><entry><title>Got Collation conflict,  How to avoid this?</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/qingsongyao/archive/2009/03/11/got-collation-conflict-how-to-avoid-this.aspx" /><id>http://blogs.msdn.com/qingsongyao/archive/2009/03/11/got-collation-conflict-how-to-avoid-this.aspx</id><published>2009-03-11T07:48:00Z</published><updated>2009-03-11T07:48:00Z</updated><content type="html">The best way to avoid SQL Server's collation conflict issue is that avoid have different collations in your database schema. If your server and database have the same collation, you will never see the conflict collation issue. if all string columns in a database use the same collation, you will see less collation conflict unless you do cross-database query. You don't need explicit set the collation for string collations, they will pick up the database's collation by default. Keep in mind, changing...(&lt;a href="http://blogs.msdn.com/qingsongyao/archive/2009/03/11/got-collation-conflict-how-to-avoid-this.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9470102" width="1" height="1"&gt;</content><author><name>Qingsong Yao</name><uri>http://blogs.msdn.com/members/Qingsong+Yao.aspx</uri></author><category term="collation" scheme="http://blogs.msdn.com/qingsongyao/archive/tags/collation/default.aspx" /></entry><entry><title>GB18030 Character Set Support in SQL Server</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/qingsongyao/archive/2009/02/24/gb18030-character-set-support-in-sql-server.aspx" /><id>http://blogs.msdn.com/qingsongyao/archive/2009/02/24/gb18030-character-set-support-in-sql-server.aspx</id><published>2009-02-24T09:51:00Z</published><updated>2009-02-24T09:51:00Z</updated><content type="html">Recently, I got several request related to GB18030 Character Set support in SQL Server. Here is one of the requests: When I try to insert different combination of GB18030 characters in to a varchar column, it gives me unique constraint violation error. insert myTable values ('32066326-6E23-4E31-B226-9F8652CE11F3', N' 㐀㐁 ᠠᠡᠢ ཌཌྷ ꀀꀁ ﺶﺷﺸ ', 'AC1', '') insert myTable values ('32066326-6e23-4e31-b226-9f8652ce11f7', N' ꀀꀁ ﺶﺷﺸ ', 'AC1', '') does anyone know cause / solution / workaround? Before going into...(&lt;a href="http://blogs.msdn.com/qingsongyao/archive/2009/02/24/gb18030-character-set-support-in-sql-server.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9442257" width="1" height="1"&gt;</content><author><name>Qingsong Yao</name><uri>http://blogs.msdn.com/members/Qingsong+Yao.aspx</uri></author></entry><entry><title>My recommendation of SQL Server’s Globalization Development</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/qingsongyao/archive/2009/02/24/my-recommendation-of-sql-server-s-globalization-development.aspx" /><id>http://blogs.msdn.com/qingsongyao/archive/2009/02/24/my-recommendation-of-sql-server-s-globalization-development.aspx</id><published>2009-02-24T09:20:00Z</published><updated>2009-02-24T09:20:00Z</updated><content type="html">Normal 0 false false false EN-US ZH-CN X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif";...(&lt;a href="http://blogs.msdn.com/qingsongyao/archive/2009/02/24/my-recommendation-of-sql-server-s-globalization-development.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9442243" width="1" height="1"&gt;</content><author><name>Qingsong Yao</name><uri>http://blogs.msdn.com/members/Qingsong+Yao.aspx</uri></author></entry><entry><title>UTF-16 Encoding and SQL Server (4) - String Function Case Study</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/qingsongyao/archive/2009/02/13/utf-16-encoding-and-sql-server-4-string-function-case-study.aspx" /><id>http://blogs.msdn.com/qingsongyao/archive/2009/02/13/utf-16-encoding-and-sql-server-4-string-function-case-study.aspx</id><published>2009-02-13T09:32:00Z</published><updated>2009-02-13T09:32:00Z</updated><content type="html">Normal 0 false false false EN-US ZH-CN X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif";...(&lt;a href="http://blogs.msdn.com/qingsongyao/archive/2009/02/13/utf-16-encoding-and-sql-server-4-string-function-case-study.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9417462" width="1" height="1"&gt;</content><author><name>Qingsong Yao</name><uri>http://blogs.msdn.com/members/Qingsong+Yao.aspx</uri></author></entry></feed>