Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Location
    Belo Horizonte - MG - Brazil
    Posts
    2

    Question Unanswered: how to determine the data type?

    Is there a way to determine the data type of a value using a SQL command? I used ISNUMERIC(field_name) on MSSQL and I'm looking for some similar in PGSQL.

    The command in mssql looks like the following:

    SELECT * FROM Results WHERE ISNUMERIC(FinalResult) = 1

    Thanks for any help.

  2. #2
    Join Date
    Sep 2003
    Posts
    35
    hmmm. Good question, but I'm not aware of any such a test being build in to Postgresql.

    I'm assuming that your field, FinalResult, is a text field, which in that case the ISNUMERIC function, if it existed, would not help you anyway becuase all rows in your field would be stored as text strings anyway. If it's a number 11 you're looking for, just convert it to text and filter on that:

    SELECT * FROM Results WHERE FinalResult = '11'

    (put quotes around the number you're looking for)

    -PJ

  3. #3
    Join Date
    Dec 2003
    Location
    Belo Horizonte - MG - Brazil
    Posts
    2
    The FinalResult field is a varchar(10).
    I store numeric and text value in this field, but I would like to know if the value is numeric (0, 1, 2 ...) or text.
    In T-SQL I can use ISNUMERIC(field).

    To solve this problem I'm testing if the value (FinalResult) is < '9999999999', but I don't like this solution.

    Thanks any way.

Posting Permissions

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