Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Group By In SQL Server

$
0
0

Hello Friends,

i have some problem in group by functionality of sql server 2008 r2.

my sample script is as below : 

-- Table Variable Declaration
declare @tbl table(Name nvarchar(50));

-- Insert Value Section
insert into @tbl values('nebi');
insert into @tbl values('nebi1');
insert into @tbl values('nebi-1');
insert into @tbl values('nebi-A');
insert into @tbl values('nebicard');
insert into @tbl values('nebi-H');

-- Get Results.
select * from @tbl order by Name;

Actual OUTPUT : 

Name
nebi
nebi1
nebi-1
nebi-A
nebicard
nebi-H

Expected OUTPUT :

Name
nebi
nebi1
nebi-1
nebi-A

nebi-H

nebicard

why nebicard displays in between nebi-A and nebi-H?

plz help me,

Regards,

sagar savsani.


savsani s.m.


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>