Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2002
    Location
    Illinois
    Posts
    1

    Question Unanswered: SQL2K - converting data type varchar to numeric Error

    I have always programmed my ASP pages with MS Access DB's and we recently got a SQL Server 2000. So, I'm totally new to SQL Server 2000.
    I trying to retrieve data from a table in SQL, based on values from two input fields (text fields) on a form in the web page.

    To process the form, I am using the following syntax:

    Set oRs = oConn.Execute("SELECT BBILNAM, BTWP, BTXP, BPARCEL, BBILADD, BBILCTYST, BBILZIP5 FROM TESTdb WHERE BTWP = 'TWP' AND BPARCEL = 'PARCEL'")

    SQL Fields in Table TESTdb are (BTWP = numeric field) and (BPARCEL = text field)

    I realize that the problem is that I'm comparing a numeric field in my table, to a text field from my form, but don't know how to convert the text field to a numeric field, prior to the execution of the select statement. I'm hoping someone can point me in the right direction. Thanks!

  2. #2
    Join Date
    Dec 2004
    Location
    CA, USA
    Posts
    63
    If BTWP is numeric it must be compared to a number (int, float, etc...).
    Last edited by pshisbey; 02-03-05 at 21:29.

  3. #3
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Unless 'TWP' is some obscure Roman Numeral, I do not think you are going to be able to compare it to numeric fields....
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

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