Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

DATE field type in SQL

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • DATE field type in SQL

    You do not specify the date format of a date field in CREATE TABLE. This is most likely because SQL stores dates in it's own proprietory format. You specify the format when you SELECT the date field, using the CHAR function: CHAR(MyDateField, USA). If you access the table in an embedded SQL program, you can also set the date format option:
     C/exec sql + set option datfmt = *usa C/end-exec 
    Then you can use the date field like any other RPG date datatype field with USA format. Hope this is enough to get you started.

  • #2
    DATE field type in SQL

    Can I do a regular WRITE command in RPG IV to this table, or do I have to do an INSERT using embedded SQL?

    Comment


    • #3
      DATE field type in SQL

      I want to create a table in SQL using the CREATE TABLE command. One of the fields I want to create is a DATE field. Is there a way to specify the date format? I want to create a DATE field in *USA format.

      Comment


      • #4
        DATE field type in SQL

        RPG IV can use the DATE type field (and TIMESTAMP). RPG III cannot. Just like with SQL, in RPG IV you specify the date format you wish to use, and it will convert it from the internally compressed format in the database to whatever format you chose. -dan

        Comment


        • #5
          DATE field type in SQL

          > RPG IV can use the DATE type field (and > TIMESTAMP). RPG III cannot. Look at CRTRPGPGM CVTOPT(*DATETIME). --buck

          Comment

          Working...
          X