Murray Brown
asked on
VB.net Record Count taking long for large tables in SQL
sSQL = "SELECT Count(*) As MyCount FROM [" & oTableName & "]"
Hi
I am using the following code to count the number of records in my SQL tables.
For larger tables of 5 million records or more it seems to take very long
Is there a faster way to do this?
Dim cn As New SqlConnection(oConnectionS tring)
Dim cmd As New SqlCommand(sSQL, cn)
cn.Open()
oCount_Records_InTable = cmd.ExecuteScalar.ToString
If cn.State <> ConnectionState.Closed Then
cn.Close()
End If
Hi
I am using the following code to count the number of records in my SQL tables.
For larger tables of 5 million records or more it seems to take very long
Is there a faster way to do this?
Dim cn As New SqlConnection(oConnectionS
Dim cmd As New SqlCommand(sSQL, cn)
cn.Open()
oCount_Records_InTable = cmd.ExecuteScalar.ToString
If cn.State <> ConnectionState.Closed Then
cn.Close()
End If
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER