#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2014
    Posts
    3
    Rep Power
    0

    Question Default values for columns don't work in Stored procedures?


    Hello,

    ich have a table using two default values for date-columns:
    Code:
    CREATE TABLE MEDIATYPES 
    (
      ID                        SMALLINT         NOT NULL,
      KEYNAME                    VARCHAR(    15)  COLLATE UTF8,
      DESCRIPTION                VARCHAR(   255)  COLLATE UTF8,
      CREATEDATE                    DATE         DEFAULT CURRENT_DATE,
      UPDATEDATE                    DATE         DEFAULT CURRENT_DATE,
     CONSTRAINT PK_MEDIATYPES PRIMARY KEY (ID)
    );
    In a strored Procedure I use the following syntax to create some entries:
    Code:
        insert into Mediatypes (ID, KEYNAME, DESCRIPTION) values(1, 'B', 'Book');     
        insert into Mediatypes (ID, KEYNAME, DESCRIPTION) values(2, 'CD',  'Compact Disc');
    The two records are stored in the table, but the fields CREATEDATE and UPDATEDATE are <null>.

    Executing the same SQL directly in an SQL-Editor-Window fills the two default columns.
    Why are the columns not filled with CURRENT_DATE when executed in stored procedure?

    Regards,
    Siegbert
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2008
    Posts
    74
    Rep Power
    11
    maybe your component is send some value (as " ").

    what component is using.
    how you are send the insert...
    etc...
    more details is always wellcome

IMN logo majestic logo threadwatch logo seochat tools logo