value of COUNT

Results 1 to 4 of 4

Thread: value of COUNT

  1. #1
    tan Guest

    Default value of COUNT

    i&#039m using asp to connect to the database.<BR>i&#039m using COUNT to get the total rows in my table:<BR>(RowNo is a field in my table name report)<BR><BR> sql="SELECT COUNT(RowNo) FROM report"<BR> set rstemp=con.execute(sql)<BR><BR>but i&#039m facing the problem to retrieve the value of the COUNT.<BR>i mean maybe using the response.write to print out the value.<BR>can anybody please help<BR>

  2. #2
    Garth Guest

    Default RE: value of COUNT

    Alias the count...<BR><BR>sql="SELECT COUNT(RowNo) AS &#039varCount&#039 FROM report"<BR>set rs = con.execute(sql)<BR>response.write rs("varCount")<BR><BR>Garth<BR>

  3. #3
    tan Guest

    Default RE: displaying the value as it is

    thanks so much..that&#039s it.<BR>but i have one more question to ask..<BR>let say the value of varCount is 000055,<BR>how can i make it display as it is (000055) instead of displaying 55 only when i use <BR>response.write rs("varCount")<BR>thanks again

  4. #4
    Garth Guest

    Default RE: displaying the value as it is

    If the value is 55 then it&#039s not going to display as 000055. If you want to display it in this manner you need to apply formatting. Something like...<BR><BR>SELECT RIGHT(&#03900000&#039+CAST(COUNT(*) AS varchar(),6)FROM..<BR><BR>Garth<BR>

Posting Permissions

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