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 131Table 6.26 shows the implementati<strong>on</strong> of the IDENTITY property feature in <strong>SQL</strong> <strong>Server</strong>and what would be the equivalent in <str<strong>on</strong>g>Oracle</str<strong>on</strong>g>.Table 6.26: Implementati<strong>on</strong> of <str<strong>on</strong>g>Oracle</str<strong>on</strong>g> Sequence in <strong>SQL</strong> <strong>Server</strong><str<strong>on</strong>g>Oracle</str<strong>on</strong>g>CREATE SEQUENCE sequence_nameSTART WITH 1 INCREMENT BY 1CREATE TABLE table_name (column1NUMBER DEFAULTsequence_name.NEXTVAl,column2 …);INSERT INTO table_name (column2, …)VALUES ( … )CREATE TABLE table_name (column1NUMBER,column2 …);INSERT INTO table_name (column1,column2, …) VALUES(sequence_name.NEXTVAL, … )<strong>SQL</strong> <strong>Server</strong>-CREATE TA BLE table_name (column1NUMBER IDENTITY(1,1),column2 …);INSERT INTO table_name (column2, …)VALUES ( … )CREATE TABLE table_name (column1NUMBER IDENTITY(1,1),column2 …);INSERT INTO table_name (column2, …)VALUES ( … )One of the advantages of sequences being independent objects is that they can be used<strong>to</strong> supply a unique identifier across multiple tables. This property of <str<strong>on</strong>g>Oracle</str<strong>on</strong>g> sequences isnot inherent in <strong>SQL</strong> <strong>Server</strong>’s IDENTITY property. If an identifier is required <strong>to</strong> be uniqueacross tables (or even databases across the globe), use the uniqueidentifier data type,which can be populated using the NEWID() functi<strong>on</strong>. The IDENTITY column can <strong>on</strong>lyhandle unique values and hence it cannot support the cycle feature of <str<strong>on</strong>g>Oracle</str<strong>on</strong>g> sequence.A maximum value also cannot be set but can be en<str<strong>on</strong>g>for</str<strong>on</strong>g>ced by choosing an appropriatesized data type <str<strong>on</strong>g>for</str<strong>on</strong>g> the IDENTITY column.Note There is no sufficient in<str<strong>on</strong>g>for</str<strong>on</strong>g>mati<strong>on</strong> inside the <str<strong>on</strong>g>Oracle</str<strong>on</strong>g> database <strong>to</strong> figure out howand where a sequence is used. Hence the applicati<strong>on</strong>'s documentati<strong>on</strong>, code, ordeveloper will have <strong>to</strong> be c<strong>on</strong>sulted <strong>to</strong> learn which sequence is used <strong>to</strong> populate acolumn. This in<str<strong>on</strong>g>for</str<strong>on</strong>g>mati<strong>on</strong> is then used <strong>to</strong> define an IDENTITY column in that table.Database Links<str<strong>on</strong>g>Oracle</str<strong>on</strong>g> database links are used <strong>to</strong> <str<strong>on</strong>g>for</str<strong>on</strong>g>m a bridge between databases (instances). Remoteand distributed transacti<strong>on</strong>s can be executed against the remote database using thedatabase link. <strong>SQL</strong> <strong>Server</strong>provides similar functi<strong>on</strong>ality under the linked server.

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

Saved successfully!

Ooh no, something went wrong!