Ok, let's go. > -----Original Message----- > From: Unmoderated discussion of advanced .NET topics. > [mailto:[EMAIL PROTECTED] On Behalf Of Jon > Stonecash > Sent: Montag, 26. Juli 2004 14:13 > To: [EMAIL PROTECTED] > Subject: [ADVANCED-DOTNET] Common Sort Order for .NET and SQL Server > > I am having a problem getting SQL Server and .NET to agree on > the sort order for some data.
Really? > My sort column in SQL Server is character data ([varchar] > (255) COLLATE SQL_Latin1_General_CP1_CI_AS). As I understand > this, the data sorts in dictionary order. Thus, a value of > "F-SA" sorts between "FR" and "FT". Tip: you seem to haves kipped reading the beginner section of your SQL documentation. Your understanding is totally unsubstantiated. > The problem is that .NET seems to think that the data is not > in order. I And guess what, .NET is right with this. Beginner SQL: unless you explicitly sort the data, it is unsorted in the returned data set. > have tried all of the CultureInfo settings that I can think > of to convince .NET to see this as ordered. I have a need to Why not fix your bugs regarding any basick nowledge how SQL works, instead of trying to get .NET agreeing? > process these rows and compare them to another sorted stream > of data and the comparison is going nuts when it gets to > these "special cases". Then why do you not sort the data? > Is there a way to get SQL Server and .NET on the same (code) > page without sorting the data internally after reading it > from SQL Server? No. SQL 101. Unless the SQL statement specifies a sort order, sort order is random. That said - why do you not just specify a sort order in your query? This is pretty simple, and you do not have to resort on the client then. It just is not automatic. Note: SQL is SET ORIENTED. Sets do not have an intrinsic sort order. Thomas Tomiczek THONA Software & Consulting Ltd. (Microsoft MVP C#/.NET) (CTO PowerNodes Ltd.) > > Jon Stonecash > > =================================== > This list is hosted by DevelopMentor(r) http://www.develop.com > Some .NET courses you may be interested in: > > NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles > http://www.develop.com/courses/gaspdotnetls > > View archives and manage your subscription(s) at > http://discuss.develop.com > =================================== This list is hosted by DevelopMentorŪ http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com