C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !






Use of new Rank() function in SQL sever 2005


Posted Date: 05 Sep 2008    Resource Type: Code Snippets    Category: SQL

Posted By: saji       Member Level: Gold
Rating:     Points: 7



In order to Provide example of Rank () function I need sample data,
here we are using “Student” table. This table consists of two Column ‘Name’ and ‘ToltalMark’. Below is Sql query for Creating and Populating Student table.


SET NOCOUNT ON
CREATE TABLE Student(
FirstName VARCHAR(20),
Mark INT
)
INSERT INTO Student VALUES ('Sree Hari',23)
INSERT INTO Student VALUES ('Sajid',40)
INSERT INTO Student VALUES ('George',6)
INSERT INTO Student VALUES ('Mary',11)
INSERT INTO Student VALUES ('Sam',17)
INSERT INTO Student VALUES ('Jafar',6)
INSERT INTO Student VALUES ('Babu',38)
INSERT INTO Student VALUES ('Larry',5)
INSERT INTO Student VALUES ('Malu',29)
INSERT INTO Student VALUES ('Nisha',49)
INSERT INTO Student VALUES ('Biju',23)


The RANK function use is given below


SELECT RANK() OVER (ORDER BY Mark DESC) AS [Rank],
FirstName,
Mark
FROM student








Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
SQL SERVER 2005  .  Clr  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Create Web Services in SQL Server
Previous Resource: Get List of Columns,views,Tables,function........
Return to Discussion Resource Index
Post New Resource
Category: SQL


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

conference call definitions

Contact Us    Privacy Policy    Terms Of Use