January 17, 2018 at 11:40 pm
Comments posted to this topic are about the item Collation order by
January 17, 2018 at 11:45 pm
Good question that made me think, thanks George.
...
January 18, 2018 at 12:24 am
nice question. really i am confused about collation now... any one explain about collation
Manik
You cannot get to the top by sitting on your bottom.
January 18, 2018 at 12:27 am
Nice question, thanks George
Really reitterates the detail differences in the way SQL Server handles the various collations
____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
January 18, 2018 at 1:45 am
January 18, 2018 at 2:06 am
I got it right. Collations are tricky business. I think this is one case where people from countries that don't use English as their primary language have an edge.
But the reference doesn't really explain anything; it makes no effort at detailing where SOH might fall in a sorting sequence.
January 18, 2018 at 2:10 am
SQL 2015?
January 18, 2018 at 2:13 am
ildjarn.is.dead - Thursday, January 18, 2018 2:10 AMSQL 2015?
It's a special release only Steve has
January 18, 2018 at 8:05 am
Thank you for your kind comments, guys.
January 18, 2018 at 1:09 pm
Here is a slight edit with the complete table variable declaration, just for fun.
Thanks for the great question!
declare @TableAsc table
( [Value] varchar(30)
);
--Declare a table variable with a varchar column and insert the following values--
insert @TableAsc values
(CHAR(65) + '-Uppercase A')
,(CHAR(1) + '-Start of header')
,(CHAR(126) + '-Tilde ~')
,(CHAR(32) + '-Space')
,(CHAR(45) + '-Dash');
SELECT *
FROM @TableAsc
ORDER BY Value COLLATE Latin1_General_CI_AS;
-------------------
A SQL query walks into a bar and sees two tables. He walks up to them and asks, "Can I join you?"
Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html
January 18, 2018 at 1:17 pm
You are quite welcome. This query shows the sort order for all ASCII characters and is a little more useful--
DECLARE @Asc INT = 0
DECLARE @TableAsc TABLE(AscVal INT, CharVal CHAR(1))
WHILE @Asc <= 127 BEGIN
INSERT @TableAsc VALUES(@Asc, char(@Asc))
SET @Asc = @Asc + 1
END
SELECT *
FROM @TableAsc
ORDER BY CharVal COLLATE Latin1_General_CI_AS
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy