Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2010
    Posts
    3

    Unanswered: List ALL tables plus Row Number - Sybase SQL Server

    Need help here, I have one database and lots of tables.
    I need to list all these tables together with row number of each table using stored procedures on sybase

    eg output

    TableName.........RowNumber
    ************************
    xxxxxxxxxx.............7
    cccccccccc...........45
    eeeeeeeeee...........23

    Any code/scripts/advice will be much appreciated

    Thanks in advanced

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    There is no such thing as row number in Sybase
    What do you consider to be the first or last row?

  3. #3
    Join Date
    Sep 2010
    Posts
    3

    List ALL tables plus Row Number - Sybase SQL Server

    I simply want a list of all tables in a database with the number of rows for each table, just like when you write SELECT count(*) FROM [tableName] - this will only give results for one specified table on [tableName].

    But in my case, i need to list all tables while counting number of rows for each table.

    I'm sure it's a simple procedure but tricky.

  4. #4
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    select name, row_count(db_id(),id) from sysobjects where type='U'

  5. #5
    Join Date
    Aug 2012
    Posts
    1

    get row count

    In our caes, for the current database, we run the stored procedure:
    sp__getrowcount
    go

    I'm not sure if that's part of sybase or not. Worth a try though.
    Note: that's two underscores.
    Last edited by behrens; 08-23-12 at 10:19. Reason: clarify

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •