.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

order by confusion?

Posted By:      Posted Date: October 16, 2010    Points: 0   Category :Sql Server
declare @t table (mystr varchar(100) primary key)
insert into @t values ('-'),('a'),('--b'),('-a-')
select * from @t order by mystr

I got output as    '-' , 'a','-a-','--b'


Ascii value of - is 48 and 'a' is 97. so its correct that  - should come first.

Ordering in first 2 rows is correct. But what about ordering of last 2 rows,   --b should come first, then -a- needs to come, as first character is same for both strings and second character, is lesser for "--b" compared to "-a-"  

Why its happening like that???

This is the collation i am using "Latin1_General_CI_AI" . Windows collation.....

View Complete Post

More Related Resource Links



Is it possible with SQL sorted in descending order according to the word?
In Table I shrajeno Mastercard, Visa, Diners etc ...

All Visa are the first in the order, another Mastercard, etc. ...

Something does not work: ORDER BY PaymentType = 'Visa';

I would not want to work in one field PaymentId (111,222,33, etc. ..) and then use the ORDER BY.

Is this possible in such a way?

Linq qry with order by basic questions


I have never tried a group by with linq, now I do and I'm stuck.

I try to convert this sql statement to its linq counterpart :

SELECT COUNT(tb_Mailer_Smses.Id) AS [cnt], tb_Mailer_mailing.Id As [Id]
,SUM( CASE WHEN tb_Mailer_smses.DLRStatus = 200 THEN 1 ELSE 0 END) As [Delivered]
FROM tb_Mailer_mailing INNER JOIN
tb_Mailer_Smses ON tb_Mailer_mailing.Id = tb_Mailer_Smses.MailingId
WHERE tb_Mailer_mailing.ApplicationId = 1
GROUP BY tb_Mailer_mailing.Id

Is there some one who can me show me the convertion process ?

Editor's Note: Code Name Confusion


We'd like to have a word about product code names this month.

MSDN Magazine February 2006

ASP.NET: Collect Customer Order Information on an Internet Site Using XML and Web Forms


XML has quickly become the new data structure standard for everything from database access to cross-platform computing. XML is typically considered to be a vehicle for data exchange, dynamic data presentation, and data storage. However, the potential of XML far surpasses those limited applications. This article examines one new use: the gathering of data across a number of forms in an ASP.NET Beta 1 framework application. The sample program is a Web app used for ordering pizza. It uses ASP and C# to gather order information and then stores it in XML. To build the application, several concepts are explained, including data collection, order persistence using cookies, grouping input forms, and formatting the data for display.

Jeff Jorczak

MSDN Magazine September 2001

order by in combination with union


 Hi All,

How can I order this by count? so if it appears above and below the union statement, I want it on top

	SELECT distinct BIER.Naam, BIER_L2.L2_Naam, BIER_L3.L3_Naam from BIER_MATCH, BIER, BIER_L2, BIER_L3

	SELECT distinct BIER.Naam, BIER_L2.L2_Naam, BIER_L3.L3_Naam from BIER_MATCH, BIER, BIER_L2, BIER_L3
	where BIER_L2.L2_ID = BIER.L2_ID and BIER_L2.L3_ID = BIER_L3.L3_ID and RECEPT_ID = @RECEPT_ID 
	and BIER_MATCH.BIER_ID is null


Is it possible to filter KPI list in order to display only relevant KPIs


I  have created a KPI list and I want to show sections of the list on various parts of my site, however, I dont seem to be able to filter the list. Has anyone tried this and had any success?

IIS - sharepoint/default website port number confusion



I have MOSS 2007 installed with IIS V7.

My default web site port is 80. When I created a new web application for my main sharepoint portal I also set it to 80. So obviously now the default web site port shows as stopped in IIS and it won't start.

What are the best practices. Should I change the port number for my portal to something else? I mean is it even a good idea to have sharepoint on port 80? If so, how do I go about changing the port number for my portal site?

any help appreciated.

Order by Nemeric column


Hi all,

Thank you for advance.

the Document Rank column is numeric and contain the values are 2,1,0,4,0,5,3,0,6

we need to get the document rank with the following orders

how can i do this?

http module calling order


Our site uses urlRewriter http module that does the url rewriting for us.

I want to create another http module that will handle our customize URL redirects. Now I want this new customize http module to be call before the UrlRewriter module (to avoid page not found messages the UrlRewriter generates). Is there a way we can contol the calling order ?

how to get current loop order number in "for each" ?

For Each item As pages.tbl1Row In pagesdim x as integerx = ?????response.write("current loop is :" & x )               Nextwhat code i need to replace with "?????" to get current loop order?

SharePoint and "Help Desk" template confusion

Okay; so I've read the three posts I found on this forum about the SharePoint Services "Help Desk" administrative template. I've scoured the internet for nuggets of wisdom; all-in-all, I've come to the conclusion that there is hardly ANY documentation for this template! :) So please excuse me if this question is considerd "noobish-ish" by some--I just a looking for a fresh set of brain cells to bounce my question off of. The template, itself, seems pretty bare bones and to the point, as far as ticketing issues. But how in the site settings do I specify a Service Request, when a domain user clicks on the "Create a Service Request " link, to go to a specific help desk email account on our Active Directory network? I see "Create a Service Request," "Service request List," "Service Request Task List;" it's getting a little confusing, as I don't use the "portal" end of SP, as much as I administrate our server. Where should I start, one and all?? ANY help will be greatly appreciated; thank you!

Confusion between sizeof(long) and LLP64

Hi, I have found the following information on MSDN "In the LLP64 data model, only pointers expand to 64 bits; all other basic data types (integer and long) remain 32 bits in length. The .NET CLR for 64-bit platforms uses the same LLP64 abstract data model." This implies that the size of long on 32 as well as 64 bit systems should be 32 bits. But when I use a long in my application, I find the underlying type to be System.Int64 and sizeof(long) returns the value of 8 implying 64 bits. I have observed this behavior on 32 bit as well as 64 bit systems. This is contradictory to the information on MSDN. Please let me know what am I missing here. Thanks, Mayur
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend