13.01.2013 Views

OpenEdge Data Management: DataServer for Microsoft SQL Server

OpenEdge Data Management: DataServer for Microsoft SQL Server

OpenEdge Data Management: DataServer for Microsoft SQL Server

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Chapter 7: The <strong>Data</strong><strong>Server</strong> Tutorial<br />

Using computed columns to enable PROGRESS_RECID<br />

support of the ROWID function<br />

Use the following procedures to create PROGRESS_RECID to support the ROWID<br />

function. Note that computed column technology is available only in MS <strong>SQL</strong> <strong>Server</strong><br />

2005 and later versions.<br />

To modify a table to support the ROWID function using a computed column:<br />

1. Add new columns PROGRESS_RECID, PROGRESS_RECID_IDENT_, and<br />

PROGRESS_RECID_ALT_, as shown:<br />

ALTER TABLE table ADD PROGRESS_RECID AS<br />

CASE WHEN PROGRESS_RECID_ALT_ is NULL<br />

THEN PROGRESS_RECID_IDENT_<br />

ELSE PROGRESS_RECID_ALT_<br />

END PERSISTED NOT NULL,<br />

PROGRESS_RECID_IDENT_ bigint identity,<br />

PROGRESS_RECID_ALT_ bigint null default NULL,<br />

CONSTRAINT table#_#table progress_recid UNIQUE(PROGRESS_RECID)<br />

2. If you have already created your schema holder, delete and recreate it.<br />

Migrating RECID-trigger mechanism to RECID computed<br />

column mechanism<br />

Use the following procedure to convert a table that supports the ROWID function from<br />

one that is trigger-enabled to the more reliable computed column-enabled. Computed<br />

column enablement is available only through MS <strong>SQL</strong> <strong>Server</strong> 2005 and later.<br />

Note: Prior to per<strong>for</strong>ming the following steps, ensure you have backed up the tables<br />

with which you will be working.<br />

To adopt a table to support the ROWID function using computed column from<br />

trigger mechanism:<br />

1. Drop the trigger on INSERT <strong>for</strong> PROGRESS_RECID column as:<br />

DROP TRIGGER _TI_tbl-name<br />

GO<br />

2. Store the current identity value on the table as follows:<br />

select ident_current('') as old_identity_value<br />

go<br />

316 <strong>OpenEdge</strong> <strong>Data</strong> <strong>Management</strong>: <strong>Data</strong><strong>Server</strong> <strong>for</strong> <strong>Microsoft</strong> <strong>SQL</strong> <strong>Server</strong>

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

Saved successfully!

Ooh no, something went wrong!