I want to write the sql query for displaying sequence number in the result..
.
E.g.
SeqNo Col1 Col2
==== === ===
1 aa aa2
2 bb bb2
3 cc cc2
The firlst column SeqNo is not the physical column of the table...It may be
a single function to retrieve the sequence number along with the result. I
know there may be a single function in SQL server to retrieve auto
sequence....
Any idea?
Thanks in advance
PeterOoSELECT ID, IDENTITY(INT,1,1) AS seq_number into #temp
FROM TableName
select * FROM #temp
DROP TABLE #temp
Hth
DishanF
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!|||OR
SELECT count(*) RecNum,
a.ID
FROM Agent a join
Agent b
on a.ID >= b.ID
group by a.ID
order by a.ID
DishanF
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!|||Thanks...Can we do another way? This way needs to create a temp table and
I'm wondering if it can affects the performance...
If SQL server has a function like AutoNumber(), there will be nice...
Anyway thanks...And if you have any alternative idea, I'd be appreciated.
"DishanF" wrote:
> SELECT ID, IDENTITY(INT,1,1) AS seq_number into #temp
> FROM TableName
> select * FROM #temp
> DROP TABLE #temp
> Hth
> DishanF
> *** Sent via Developersdex http://www.examnotes.net ***
> Don't just participate in USENET...get rewarded for it!
>
Showing posts with label auto. Show all posts
Showing posts with label auto. Show all posts
Wednesday, March 7, 2012
Tuesday, February 14, 2012
display data without auto grouping in report builder
I have a report built by report builder. When I run report several column
data did not show repeated data on each row. Instead it just show one time
and the other repeated data field just auto merged with the first cell. Is
there any way to show each row data no matter it is the same as the one in
the cell above?
Example now I see:
Type City State
HSLA PHILADELPHIA PA
NORCROSS GA
PAOLI PA
PAOLI PA
What I want to get is:
HSLA PHILADELPHIA PA
HSLA NORCROSS GA
HSLA PAOLI PA
HSLA PAOLI PA
Is it possible to do that in "design report" or after hit "Run Report"? I
don't want the auto grouping in adhoc report. Please HELP! I really
appreciate it.I figured it out. The column is shown in the group if you click 'sort and
group'. Just drag all the fields you want and drop them on the table so that
the group is created in entity name instead of the individual field names.
"Daisy" wrote:
> I have a report built by report builder. When I run report several column
> data did not show repeated data on each row. Instead it just show one time
> and the other repeated data field just auto merged with the first cell. Is
> there any way to show each row data no matter it is the same as the one in
> the cell above?
> Example now I see:
> Type City State
> HSLA PHILADELPHIA PA
> NORCROSS GA
> PAOLI PA
> PAOLI PA
> What I want to get is:
> HSLA PHILADELPHIA PA
> HSLA NORCROSS GA
> HSLA PAOLI PA
> HSLA PAOLI PA
> Is it possible to do that in "design report" or after hit "Run Report"? I
> don't want the auto grouping in adhoc report. Please HELP! I really
> appreciate it.
>
data did not show repeated data on each row. Instead it just show one time
and the other repeated data field just auto merged with the first cell. Is
there any way to show each row data no matter it is the same as the one in
the cell above?
Example now I see:
Type City State
HSLA PHILADELPHIA PA
NORCROSS GA
PAOLI PA
PAOLI PA
What I want to get is:
HSLA PHILADELPHIA PA
HSLA NORCROSS GA
HSLA PAOLI PA
HSLA PAOLI PA
Is it possible to do that in "design report" or after hit "Run Report"? I
don't want the auto grouping in adhoc report. Please HELP! I really
appreciate it.I figured it out. The column is shown in the group if you click 'sort and
group'. Just drag all the fields you want and drop them on the table so that
the group is created in entity name instead of the individual field names.
"Daisy" wrote:
> I have a report built by report builder. When I run report several column
> data did not show repeated data on each row. Instead it just show one time
> and the other repeated data field just auto merged with the first cell. Is
> there any way to show each row data no matter it is the same as the one in
> the cell above?
> Example now I see:
> Type City State
> HSLA PHILADELPHIA PA
> NORCROSS GA
> PAOLI PA
> PAOLI PA
> What I want to get is:
> HSLA PHILADELPHIA PA
> HSLA NORCROSS GA
> HSLA PAOLI PA
> HSLA PAOLI PA
> Is it possible to do that in "design report" or after hit "Run Report"? I
> don't want the auto grouping in adhoc report. Please HELP! I really
> appreciate it.
>
Subscribe to:
Posts (Atom)