April 1, 2009 at 7:02 am
I am using YEAR and Month groups in report and want to show serial no. for selected reange of months for year like
I choose Dec-2008 to April 2009. It should be show data like this
COL1 COL2 COL3
Dec-2008 1 DATA1
JAN-2008 2 DATA1
FEB-2008 3 DATA1
MAR-2008 4 DATA1
PLEASE SUGGEST ME HOW I GENERATE COL2(SERIAL NO.) BASED ON COL1 USING SSRS 2008
April 1, 2009 at 7:16 am
If your datasource is SQL Server 2005 or greater you can add that column to your dataset using the ROW_NUMBER() function. See ROW_NUMBER() in BOL. The syntax would be like this:
SELECT
COL1,
ROW_NUMBER() OVER(ORDER BY COL1) AS COL2,
COL3
FROM
table
In SSRS also has ROW_NUMBER() function you can use as well. Here it is in BOL. Here's an example:
Row_Number(Nothing)
"Nothing" is the scope. Using "Nothing" means the entire dataset. If you have groups you can replace "Nothing" with the group name.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply