Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Posts
    1

    Unanswered: Referencing data type

    I want to CAST a varible to the datatype of a column from table.

    That is,

    CAST(VbleName AS tablename.columnname.datatype)

    I can do CAST(VbleName AS Integer). The reasons I don't want to do like that are,

    1. In future if the type of column change I have to goback and change all these codes.
    2. While coding, I have full the respective table def. to findout what the respective data type is.

    Do any know how to do this??

    Thanks for your help.

    --Prabhu.

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: Referencing data type

    You cannot do this in plain SQL ...

    But I think, if you use, JDBC etc, you can build the query dynamically and make use of the new column datatype

    HTH

    Sathyaram

    Originally posted by Prabhu Gopalan
    I want to CAST a varible to the datatype of a column from table.

    That is,

    CAST(VbleName AS tablename.columnname.datatype)

    I can do CAST(VbleName AS Integer). The reasons I don't want to do like that are,

    1. In future if the type of column change I have to goback and change all these codes.
    2. While coding, I have full the respective table def. to findout what the respective data type is.

    Do any know how to do this??

    Thanks for your help.

    --Prabhu.
    Visit the new-look IDUG Website , register to gain access to the excellent content.

Posting Permissions

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