SQL Server DDL for Oracle

  • [font="Courier New"]I have to create DDL for a SQL 2008 R2 table to accomodate an Oracle table being imported.

    How is Oracle DATA_TYPE = NUMBER defined in SQL Server?

    How is Oracle DATA_TYPE = VARCHAR2 defined in SQL Server?

    The Oracle attributes I received include:

    TABLE_NAME

    My_Oracle_table

    Columns DATA_TYPE CHAR_LENGTH DATA_LENGTH DATA_PRECISION NULLABLE

    my_column_1 NUMBER 0 22 4 N

    my_column_2 VARCHAR2 13 13 N

    my_column_3 CHAR 1 1 N

    Is this correct?

    CREATE TABLE [dbo].[My_Oracle_table](

    [my_column_1] [numeric](22, 4) NOT NULL,

    [my_column_2] [varchar](13) NOT NULL,

    [my_column_3] [char](1) NOT NULL )

    ON [PRIMARY][/font]

    BT
  • just found this: http://weblogs.sqlteam.com/jamesw/archive/2010/08/04/datatypes-translation-between-oracle-and-sql-server-part-2-number.aspx

    Oracle allows numbers to be defined with a scale greater than the precision, such as NUMBER(4,5), but SQL Server requires the precision to be equal to or greater than the scale. To ensure there is no data truncation, if the scale is greater than the precision at the Oracle database, the precision is set equal to the scale when the data type is mapped: NUMBER(4,5) would be mapped as NUMERIC(5,5).

    BT

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply