12.07.2015 Views

Solution Guide for Migrating Oracle on UNIX to SQL Server - Willy .Net

Solution Guide for Migrating Oracle on UNIX to SQL Server - Willy .Net

Solution Guide for Migrating Oracle on UNIX to SQL Server - Willy .Net

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<str<strong>on</strong>g>Soluti<strong>on</strong></str<strong>on</strong>g> <str<strong>on</strong>g>Guide</str<strong>on</strong>g> <str<strong>on</strong>g>for</str<strong>on</strong>g> <str<strong>on</strong>g>Migrating</str<strong>on</strong>g> <str<strong>on</strong>g>Oracle</str<strong>on</strong>g> <strong>on</strong> <strong>UNIX</strong> <strong>to</strong> <strong>SQL</strong> <strong>Server</strong> <strong>on</strong> Windows 113CREATE TABLE NOT NULL CONSTRAINTS(c<strong>on</strong>straint_name varchar2(30),owner varchar2(30)table_name varchar2(30),column_name varchar2(30),search_c<strong>on</strong>diti<strong>on</strong> clob);INSERT INTO NOT NULL CONSTRAINTSSELECT dc.c<strong>on</strong>straint_name, dc.owner, dc.table_name, dcc.column_name,<strong>to</strong>_lob(dc.search c<strong>on</strong>diti<strong>on</strong>)FROM dba_c<strong>on</strong>straints dc, dba_c<strong>on</strong>s_columns dccWHERE dc.owner = dcc.ownerAND dc.c<strong>on</strong>straint_name = dc c.c<strong>on</strong>straint_nameAND dc.c<strong>on</strong>straint_type = 'C'AND dc.owner = 'user_name';COMMIT;SELECT *FROM NOT_NULL_CONSTRAINTSWHERE dbms_lob.instr(search_c<strong>on</strong>diti<strong>on</strong>, 'IS NOT NULL',1,1) > 0;NOT NULL c<strong>on</strong>straints can be created <strong>on</strong> tables using Enterprise Manager and theCREATE TABLE T-<strong>SQL</strong> statement. To create a NOT NULL c<strong>on</strong>straint using Enterprise Manager, follow thesesteps:1. In the Table Designer, the Allow Nulls column should be unchecked <str<strong>on</strong>g>for</str<strong>on</strong>g> en<str<strong>on</strong>g>for</str<strong>on</strong>g>cingthe NOT NULL c<strong>on</strong>straint and checked <strong>to</strong> indicate a NULL c<strong>on</strong>straint. To create a NOT NULL c<strong>on</strong>straint Using T-<strong>SQL</strong>, use the following syntax:CREATE TABLE table_name(column_name datatype [ CONSTRAINT c<strong>on</strong>straint_name ]{ NULL | NOT NULL },…)Check C<strong>on</strong>straintBoth <str<strong>on</strong>g>Oracle</str<strong>on</strong>g> and <strong>SQL</strong> <strong>Server</strong> use the same syntax <strong>to</strong> define check c<strong>on</strong>straints; both alsohave similar restricti<strong>on</strong>s in its usage. CHECK c<strong>on</strong>straints can be defined <strong>on</strong> a singlecolumn or multiple columns at the table level. The c<strong>on</strong>diti<strong>on</strong>s specified in the CHECKclause should evaluate <strong>to</strong> a Boolean value of TRUE or FALSE. The c<strong>on</strong>diti<strong>on</strong>s can refer<strong>to</strong> other columns but are restricted <strong>to</strong> the row being modified.Both <str<strong>on</strong>g>Oracle</str<strong>on</strong>g> and <strong>SQL</strong> <strong>Server</strong> allow multiple CHECK c<strong>on</strong>straints <strong>on</strong> a column. A columnc<strong>on</strong>straint can <strong>on</strong>ly reference the column it is being created <strong>on</strong>. Each c<strong>on</strong>straint can havemultiple c<strong>on</strong>catenated c<strong>on</strong>diti<strong>on</strong>s. The process <strong>to</strong> create check c<strong>on</strong>straints <strong>on</strong> tablesusing Enterprise Manager and T-<strong>SQL</strong> is provided in the following procedures. To create a check c<strong>on</strong>straint using the Table Designer in Enterprise Manager,follow these steps:1. In the Table Designer, click the Manage C<strong>on</strong>straints butt<strong>on</strong> <strong>to</strong> bring up the tableProperties window with the Check C<strong>on</strong>straints pane active.2. Click the New butt<strong>on</strong> <strong>to</strong> add a c<strong>on</strong>straint.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!