Avoid using varchar or char data type

     Today,  I like to put one suggestion for choosing the data type of string column.  My recommendation is always go with nvarchar type. You will not be regret if your database always using nvarchar type.  For example, our SharePoint backend database always use nvarchar type, and they don’t have any issue related to store…

5

Do not alter database collation in your server

Today, I like to provide one suggestion related to change database collation. In Alter Database T-SQL at http://msdn.microsoft.com/en-us/library/ms174269.aspx,  we can see example of changing database ‘s collation as:   Alter Database db2 collate latin1_general_ci_as It seems pretty trival to change a database collation.  However,  it actually does not work in most of the cases.  The…

2

How to make Like Case Sensitive?

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))…

0

Unicode References

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…

1

SQL Server and UTF-8 Encoding (1) -True or False

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…

74

What I was doing these days?

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…

1

SQL Server’s Binary Collations

   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…

2

Be aware of comparing unicode constant with varchar column (updated)

    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.,…

0

Why I write so many collation topics?

   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…

9