How to get rowcount or row number

Hello, Sybase experts,

I have a table, when I select it I want to display row number as well.
E.g. Table T1(c1,c2)
c1    c2
---   ---
aaa   bbb
ppp   qqq
fff   ggg
....

I want to get results like this:
rowno   c1    c2
-----  ---   ---
1      aaa   bbb
2      ppp   qqq
3      fff   ggg
....


If I use:
select rowno=@rowcount,c1,c2
from T1

I will get:
rowno   c1    c2
-----  ---   ---
0      aaa   bbb
0      ppp   qqq
0      fff   ggg
....

Which is NOT what I want, but how can I do that ?

Thank you very much

Albert


---== Posted via the PFCGuide Web Newsreader ==---
http://www.pfcguide.com/_newsgroups/group_list.asp 
0
Albert
10/6/2005 4:17:50 PM
sybase.ase.general 8655 articles. 0 followers. Follow

1 Replies
321 Views

Similar Articles

[PageSpeed] 39

Answered in sybase.public.ase.administration.  Please don't post the same
question
to multiple sybase.public.ase.* newsgroups, just pick the one most
appropriate newsgroup and
post there.

-bret


Albert wrote:

> Hello, Sybase experts,
>
> I have a table, when I select it I want to display row number as well.
> E.g. Table T1(c1,c2)
> c1    c2
> ---   ---
> aaa   bbb
> ppp   qqq
> fff   ggg
> ...
>
> I want to get results like this:
> rowno   c1    c2
> -----  ---   ---
> 1      aaa   bbb
> 2      ppp   qqq
> 3      fff   ggg
> ...
>
> If I use:
> select rowno=@rowcount,c1,c2
> from T1
>
> I will get:
> rowno   c1    c2
> -----  ---   ---
> 0      aaa   bbb
> 0      ppp   qqq
> 0      fff   ggg
> ...
>
> Which is NOT what I want, but how can I do that ?
>
> Thank you very much
>
> Albert
>
> ---== Posted via the PFCGuide Web Newsreader ==---
> http://www.pfcguide.com/_newsgroups/group_list.asp

0
Bret
10/6/2005 4:39:39 PM
Reply:

Similar Artilces:

How to set the row number and get the row number for ("selected row) in Datagrid
I face a problem that i can't get the selected row of the datagrid in both server side script (VB.net) and client side script (javascript) As i can't use the button column / hyperlink column in the datagrid. Thus , i need to handle the change the background color of the selected row and also to get the selected row number for Update/Delete. Thanks in advance. This depends on how do you perform the selection. Do you want to implement chaning of the SelectedRow at the client side without any postback? If you have no issues with postback, then you can do s little trick here: 1. ...

Get the Row Number or Row ID
Hi, I am using Sybase Central v4.3 with Interactive SQL to query the SQL Commands. My concern is how to get the rownumber or row id in select queries. Is there any in built commands in the ASE. If not please suggest me how to get the rownumber. Thanks.... Unless i'm mistaken, ASE does not use a rowid... it can have a timestamp, but it is updated with every modification to the row. http://infocenter.sybase.com/help/topic/com.sybase.help.ase_15.0.blocks/html/blocks/blocks34.htm -- Cory Sane [TeamSybase] Certified Sybase Associate DBA for ASE 15.0 "Santhanam P" wrote...

The row number and offset of each row in the page should have a matching entry in row number table
Is the proper correction for the following to recreate the table BCPout/IN or table to table insert, or just drop and recreate the index? Row number is 0. Is there a way to correct just the data page? Table Corrupt: The row number and offset of each row in the page should have a matching entry in row number table; check this page (page#=772121 row#=0 offset in row number table=0) Table Corrupt: The row number and offset of each row in the page should have a matching entry in row number table; check this page (page#=772121 row#=0 offset in row number table=0) Table Corrupt: The row...

get number from row
if i have a this string to select a row from database of acess: select TOP 1 * from odkazy how i elicit from it id column? i need know id from select row then just get the id... select top 1 id from odkazy... PS..you would need an order by clause in the select statement otherwise the TOP has no meaning.. hth***********************Dinakar NethiLife is short. Enjoy it.*********************** my problem: (for example) if i have 5 columns with numbers in select row and i want display cast of this numbers I write: one = ds.tables("Odkazy").Rows(i)("...

How do I get the row number?
I have tryed to find a way to include the row number in a querry but without result. I have a table select some rows ordered and now I will add a column called rank How do I get the rownumber in the field rank ? Thanks in advance Jan O Jan O www.olsmar.com The way I'd suggest assigning a row number to your resultset is to INSERT your resultset into a temporary table or table variable which has an IDENTITY column, something like this: -- set up a table variable to hold the resultset DECLARE @myTable (Rank int identity(1,1) primary_key, ColumnA va...

How do you get the number of rows
I have a gridview and I want to display the total number of rows of data like 5000 rows? This is not the same as the GridView1.Rows.Count, which gives the number of rows being displayed like 10 of 5000 rows. How do I get at the total? Hi, i think what you are asking is how to get the number of rows of the bounded dataset. Lets say you bound a dataset to the grid, you only need to get the number of rows of the first table in the dataset: myDataset.tables(0).rows.count As simple as that!   regards, njs That works in ASP.NET 1.x That doesn't work in ASP.NET 2.0...

getting the number of rows...
how can you get the number of rows in query resault with out filling dataset and checking the "count"? afaik - you can't - - you've got to have an entity to count the rows - the dataset is the 'finished product' that contains the result of your query - until you've queried and received the data from the database, you don't know how many rows you've receivedDavid WierMCP/ASPInsiderASPNet101.com - where to look first!Control Grouper - easily control properties for multiple controls with one control!Calendar Express - The Best HTML Calendar Generator on the web!(Please 'Mark as ...

How to get the number of rows that were UPDATED
Using DW.NET 1.0 And VB.NET 71 I have a datastore after Updatadata() i want know the number of rows updated. How to get the number of rows ?? Thanks Peter Stojkovic Try using the RowsAffected property of the Transacation object. Regards, Dave Fish Sybase DataWindow .NET Webcast December 16, 2004: www.customermining.com/Sybase/NETRegPage.html TeamSybase blogs: http://www.teamsybase.net/blogs DataWindow.NET code examples available on CodeXchange: http://datawindownet.codexchange.sybase.com On 16 Dec 2004 05:00:23 -0800, "Peter M�ller" &...

Getting row number from SelectedIndexChanged??
Hello, now, I have 2 template columns, the first is a hyperlink column that consist of userno, the next is the gender which is represented by a radiobuttonlist. The radiobuttonlist fire up a method when somebody clicks on or change the selected one: Protected Sub SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Dim objItem As DataGridItem Response.Write(CType(DataGrid1.Items.Item(DataGrid1.SelectedIndex).FindControl("hl_oNo"), HyperLink)) End Sub I need to read the userno from the hyperlink column so that the...

Getting the number of Rows (Records)
How do I get and return the number of rows (records) in a sql 2005 database, Some code samples would be helpful Thanks Joe   Hi, that would be something like this: select count(*) from yourTable The * can also be replaced by a columnname but since I didn't know your table structure I used * in the example. Grz, Kris.Read my blog. Handy Firefox plugins for web developers.Workaround for non working Mark as answer buttons. Ok, guys this isn't going to work. Take a look at my code. I need it to return the current record that was inserted. Is there a was to do that &n...

How to get a row number in DDDW
Hi, All, When a DDDW on a column opens for the user to pick an item, and when the user clicks on a row or scrolls up/down in the DDDW, is there any way to get the row number of the DDDW? I have tried this in PB 5, and it did not seem to work. Any ideas about PB 6.5 or PB 7.0? Thanks in advance. Ben You can't directly get the row that the user clicked on. You can write code in the ItemChanged event of the parent DW where you get the data value on the parent column, get a handle to the child DW, then perform a Find ( ) on the child DW looking the the data value in the rel...

Getting the number of rows in a datagrid
Hi, The datagrid on my webform gets filled with some data from my database. I want to find the number of rows that are populated on the datagrid. What is the way to simply find the number of rows that have been filled with data. I want to use that in a for loop. Thanks, Snigdha After you populate your datagrid with data, all you have to do is:DataGrid.Items.CountThat will give you a count of how many rows are in your grid.DarmarkMark as Answer, if this reply answers your post. Get the row count based on your DataSource....For example, if the DaatSource is DataTable dtTable...it would ...

Get Row Number in Datagrid
Hi I want to delete a databound row in a datagrid using the delete button on the datagrid. I have tried to use Dim RowID As Integer = Convert.ToInt32(shOTQDataGrid1.Items.Item(CInt(e.Item.ItemIndex))) to get the row number. Dim SoqID As Label = CType(shOTQDataGrid1.Items(RowID).FindControl("SOQID"), Label) I need to get the row number(e.g. 0). I search for the specific item "SOQID" and then use a custom Class to delete the record from the Database with the value of SoqID.Text. Dim sh As New ShiftOvertimeQualifiersClass Dim SoqID As Label = CType(shO...

Web resources about - How to get rowcount or row number - sybase.ase.general

Twitter
Log in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

iRail API
BeRoads data provider website

Imprimerie Basel — atelier des arts et sciences
{ "tiddlers": { "$:/core/copyright.txt": { "title": "$:/core/copyright.txt", "type": "text/plain", "text": "TiddlyWiki created by Jeremy Ruston, ...

Tennis - News - Big 12 Conference - Official Athletic Site
Official site of Big 12 Conference athletics. The home of sports for the Baylor Bears, Iowa State Cyclones, Kansas Jayhawks, Kansas State Wildcats, ...

Printing simple tabular reports with JTable
Printing simple tabular reports with JTable - Alan's Ramblings

Two Weird 'Tricks' For Testing Graphical Code
Before I do a bunch of "Extract Method" refactorings, I looked over the code and wrote this comment: // creates pdf context. // computes rowCount ...

Breaking the SQL Barrier: Google BigQuery User-Defined Functions
... rows. The following contrived example illustrates this error: // myCode.js var numRows = 0; function dontDoThis(r, emit) { emit(rowCount: ++numRows); ...

Browse DLL M page 1
Download all your missing DLL, OCX and VXD files starting with the letter M free of charge. Just click the link below

A simple Delphi wrapper for Sqlite 3
Most applications use a database, and there are many excellent database engines to choose from, both free and commercial. SQLite is a smal

@@PACK_RECEIVED (Transact-SQL)
United States (English) Sign in Home Library Learn Samples Downloads Support Community Forums MSDN Library Servers and Enterprise Development ...

Resources last updated: 2/5/2016 4:42:02 PM