SQL server 7 to Oracle
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: SQL server 7 to Oracle

  1. #1
    Join Date
    Sep 2002
    Posts
    1
    Hello all,

    I am very new to Oracle. I currently program in SQL Server and need to re-write some of my scripts to oracle. How would I re-write the following table?

    -===============================
    if object_id('dbo.mytable') is null
    create table mytable(
    col1 char(20) not null,
    col2 int not null,
    col3 varchar(20) null,
    col4 bit null constraint df_col4 default (0),
    tabid numeric(18, 0) identity (1, 1) not null ,
    constraint key_mytable primary key (tabid)
    )
    go
    --==============================

    Is this correct?
    create table mytable(
    col col1 char(20) not null,
    col2 number not null,
    col3 varchar2(20) null,
    col4 number null constraint df_col4 default (0),
    tabid number(18, 0) identity (1, 1) not null ,
    constraint key_mytable primary key (tabid)
    )


    They look very similiar.

    Thanks,
    Eddie

  2. #2
    Join Date
    Nov 1999
    Location
    Kuwait
    Posts
    122

    explain.........

    Could u explain what are you tryin to do over here?

    col4 bit null constraint df_col4 default (0),
    tabid numeric(18, 0) identity (1, 1) not null ,
    constraint key_mytable primary key (tabid)
    )

    waiting...
    NK
    ====================================================
    Stand up for your principles even if you stand alone!
    ====================================================

  3. #3
    Join Date
    Mar 2001
    Location
    Reading, U.K
    Posts
    598
    I think this should help.
    You don't have identity function as you have in sybase/mssql for autoincreament.
    for this u have to create a sequence and have to insert them using a trigger.

    "col4 number default 0,"
    for this NULL is not required

    create table mytable(
    col1 char(20) not null,
    col2 number not null,
    col3 varchar2(20) null,
    col4 number default 0,
    tabid number(18, 0) not null ,
    constraint key_mytable primary key (tabid)
    );

    hope this helps U
    Cheers!
    Cheers!
    OraKid.

Posting Permissions

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


Click Here to Expand Forum to Full Width