Results 1 to 21 of 21

Thread: Count rows in tables

Threaded View

  1. #1

    Thread Starter
    Fanatic Member staticbob's Avatar
    Join Date
    Jan 2005
    Location
    Manchestershire, UK Cabbage: I do
    Posts
    619

    Count rows in tables

    Guys,

    I need to count the number of rows in each table of an oracle database, the database has around 200 tables. I need to do this on a win form in Vis Studio. Usually, I would load into a dataset and just do a count on that, but the size of the database is crashing visual studio.

    Its been a while soince I coded so sorry for the simplicity! I should know this. So far I have this to get a list of all of the table names....

    Code:
    Private Shared mda As OracleDataAdapter
            Public Shared Function GetTableNames() As DataTable
                Dim dt As New DataTable
                Dim strSQL As String = String.Empty
                strSQL = "Select table_name from All_Tables"
    
                Dim oda As New OracleDataAdapter
                oda.SelectCommand = New OracleCommand(strSQL, cnn)
                With oda.SelectCommand
                    If .Connection.State = ConnectionState.Closed Then
                        .Connection.Open()
                    End If
                End With
                oda.Fill(dt)
                Return dt
                oda.SelectCommand.Connection.Close()
                cnn.Close()
            End Function

    Now how do I get a row count in there for each table....

    Thanks
    Bob
    Last edited by staticbob; Jul 17th, 2007 at 05:33 AM.
    "I dislike 7 am. If 7 am were a person, I would punch 7 am in the biscuits." - Paul Ryan, DailyRamblings

Posting Permissions

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



Click Here to Expand Forum to Full Width