Create Table DDL: WITH DEFAULT question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Comcast News

    Create Table DDL: WITH DEFAULT question

    I have some DDL from DB2/mainframe and it does not list the default value.

    Example:

    create table foo (
    col1 char(2) not null with default
    );

    Question: So what value does DB2 default in here?

    I'm familiar with the following format......

    create table foo (
    col1 char(2) not null with default 'HI'
    );

    Thanx in advance,

    Ray


  • Mark A

    #2
    Re: Create Table DDL: WITH DEFAULT question

    "Comcast News" <dublin26pt5@co mcast.net> wrote in message
    news:1NidnQnSkb IA6ACiRVn-jw@comcast.com. ..[color=blue]
    > I have some DDL from DB2/mainframe and it does not list the default value.
    >
    > Example:
    >
    > create table foo (
    > col1 char(2) not null with default
    > );
    >
    > Question: So what value does DB2 default in here?
    >
    > I'm familiar with the following format......
    >
    > create table foo (
    > col1 char(2) not null with default 'HI'
    > );
    >
    > Thanx in advance,
    >
    > Ray
    >[/color]
    The default depends on the data type. I.E, blanks for character, zero for
    numeric, etc.


    Comment

    • P. Saint-Jacques

      #3
      Re: Create Table DDL: WITH DEFAULT question

      CHAR with default ==> Blanks
      VARCHAR with default ==> 1 blank
      Numeric with default ==>0

      I believe this is the SQL ref. Man. online.
      HTH, Pierre.

      Comcast News wrote:[color=blue]
      > I have some DDL from DB2/mainframe and it does not list the default value.
      >
      > Example:
      >
      > create table foo (
      > col1 char(2) not null with default
      > );
      >
      > Question: So what value does DB2 default in here?
      >
      > I'm familiar with the following format......
      >
      > create table foo (
      > col1 char(2) not null with default 'HI'
      > );
      >
      > Thanx in advance,
      >
      > Ray
      >
      >[/color]

      --
      Pierre Saint-Jacques
      IBM DB2 Cerified Solutions Expert - Administration
      SES Consultants Inc.

      Comment

      • Database Guy

        #4
        Re: Create Table DDL: WITH DEFAULT question

        "P. Saint-Jacques" <p.stjacques@vi deotron.ca> wrote in message news:<3F9DA5EA. 9030204@videotr on.ca>...[color=blue]
        > CHAR with default ==> Blanks
        > VARCHAR with default ==> 1 blank
        > Numeric with default ==>0[/color]

        Default for VARCHAR NOT NULL is the empty string in fact.
        Default for time-related datatypes (TIME, DATE, TIMESTAMP) is current time.


        DG

        Comment

        • P. Saint-Jacques

          #5
          Re: Create Table DDL: WITH DEFAULT question

          Thanks for setting me strait.
          Regards, Pierre.

          Database Guy wrote:[color=blue]
          > "P. Saint-Jacques" <p.stjacques@vi deotron.ca> wrote in message news:<3F9DA5EA. 9030204@videotr on.ca>...
          >[color=green]
          >>CHAR with default ==> Blanks
          >>VARCHAR with default ==> 1 blank
          >>Numeric with default ==>0[/color]
          >
          >
          > Default for VARCHAR NOT NULL is the empty string in fact.
          > Default for time-related datatypes (TIME, DATE, TIMESTAMP) is current time.
          >
          >
          > DG[/color]

          --
          Pierre Saint-Jacques
          IBM DB2 Cerified Solutions Expert - Administration
          SES Consultants Inc.

          Comment

          Working...