Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003
    Posts
    4

    Unanswered: automatic type conversion

    I created a table like this

    create table T1 (F1 int)

    On MSSQL and Oracle, such insert statement:

    insert into T1 (F1) values ('3')

    would work, but not on DB2.

    Is there a way to make DB2 automatically convert the value like MSSQL and Oracle can do?

    Thanks.
    Tawee.

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    The correct syntax in DB2 is:
    insert into T1 (F1) values (3)

    You might be able to use the CAST fucntion:
    insert into T1 (F1) values (cast '3' as integer)
    but I am not sure if this will work.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

Posting Permissions

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