You are here: Re: Sorting - character after 'Z'? « MsSQL Server « IT news, forums, messages
Re: Sorting - character after 'Z'?

Posted by Erland Sommarskog on 10/01/03 11:19

[posted and mailed, please reply in news]

Duy Lam (duylam@gmail.com) writes:
> I'm using collation SQL_Latin1_General_CP1_CI_AS and I need to sort a
> varchar field. There are some elements, however, that I want to come
> AFTER any alphabetic characters. Is there any character that sorts
> after "Z"? In normal ASCII, there are various characters that would
> sort after "Z" (e.g. "~"), but I can't seem to figure out what the case
> would be in the SQL_Latin1_General_CP1_CI_AS collation. Any ideas?

Looks like you have to learn Icelandic. :-) The script below helps you
out:

CREATE TABLE slafs (a int IDENTITY,
b AS char(a),
c int NOT NULL)
go
INSERT slafs (c) SELECT TOP 255 OrderID FROM Northwind..Orders
go
SELECT * FROM slafs ORDER BY b
SELECT * FROM slafs ORDER BY b COLLATE SQL_Latin1_General_CP1_CI_AS
go
DROP TABLE slafs


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация