ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Inserting date and time to a 8,0 numeric field in sql

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

  • Inserting date and time to a 8,0 numeric field in sql

    How do I insert the date and time into a 8,0 field using SQL.

    insert into library/file name (IRDEPD,IRDEPT)
    values(current date,current time)

    Thanks,

    DAC

  • #2
    Re: Inserting date and time to a 8,0 numeric field in sql

    Dec(Replace(Char(Current_Date,iso),'-',''),8,0)) )
    Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

    Comment


    • #3
      Re: Inserting date and time to a 8,0 numeric field in sql

      If you are on release 7.1 you can also use the following function:

      Code:
      Int(VarChar_Format(Current_Timestamp, 'YYYYMMDD')), 
      Int(VarChar_Format(Current_Timestamp, 'HH24MISS'))
      And if you are already on release 7.2 - SQL can convert a date, time or timestamp value into a numeric value by using one of the functions BIGINT, INT or DEC

      Code:
      Int(Current_Date), Dec(Current_Date, 8, 0)
      Int(Current_Time), Dec(Current_Time, 6, 0)
      Birgitta

      Comment


      • #4
        Re: Inserting date and time to a 8,0 numeric field in sql

        Deleted!!!
        Last edited by B.Hauser; March 27, 2015, 10:49 AM. Reason: Double Post

        Comment

        Working...
        X