Sql statement

Results 1 to 2 of 2

Thread: Sql statement

  1. #1
    Join Date
    Dec 1969

    Default Sql statement

    &nbsp;<BR>I am wonder if i select a datafield from a database which consists over 10k record, will it slow down the performance of ASP? <BR><BR>Can i straight away get the recordcount instead of select * the data then only count it?

  2. #2
    Join Date
    Dec 1969

    Default RE: Sql statement

    You can count the number of records in a table using the COUNT keyword in your SQL statement. If you had a table named TableName and you wanted to count the number of rows in the total table, you could do:<BR><BR>SELECT COUNT(*) FROM TableName<BR><BR>To retrieve this value in ASP you could do:<BR><BR>Set objRS = objConn.Execute("SELECT COUNT(*) FROM TableNam")<BR>Response.Write "There were " & objRS(0) & " records."<BR><BR>You can also count a specific subset of records in a table using the WHERE clause, like so:<BR><BR>SELECT COUNT(*) FROM TableName<BR>WHERE someWhereCondition<BR><BR>Hope that helps! Happy Programming!

Posting Permissions

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