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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

Note: Starting in <strong>OpenEdge</strong> Release 10.1B, the default PROGRESS_RECID recognizes<br />

an INT64 value <strong>for</strong> a MS <strong>SQL</strong> <strong>Server</strong> <strong>Data</strong><strong>Server</strong>. The unique key value in the<br />

PROGRESS_RECID will be derived by default from a 64-bit value. (For prior<br />

releases, the value was derived, by default, from the 32-bit INTEGER.)<br />

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

1. Per<strong>for</strong>m these tasks:<br />

a. Add a column of the integer data type named PROGRESS_RECID. The new<br />

column must be able to contain null, as shown:<br />

alter table table<br />

add PROGRESS_RECID integer null<br />

b. Add a column with identity characteristics named PROGRESS_RECID_IDENT_.<br />

The new column must have the integer data type, as shown:<br />

alter table table<br />

add PROGRESS_RECID_IDENT_<br />

integer identity<br />

2. Create a trigger to maintain the PROGRESS_RECID column:<br />

create trigger _TI_table ON table <strong>for</strong> insert as<br />

RAISERROR ('PSC-init',0,1)<br />

SET XACT_ABORT ON<br />

SET LOCK_TIMEOUT -1<br />

if ( select PROGRESS_RECID from inserted) is NULL<br />

begin<br />

update t set PROGRESS_RECID = i.IDENTITYCOL<br />

from customer t JOIN inserted i ON<br />

t.PROGRESS_RECID_IDENT_ = i.PROGRESS_RECID_IDENT_<br />

select convert (bigint, @@identity)<br />

end<br />

SET XACT_ABORT OFF<br />

3. Create a non-unique index <strong>for</strong> the PROGRESS_RECID and a unique index <strong>for</strong> the<br />

PROGRESS_RECID_IDENT, respectively:<br />

create index #_#progress_recid on (PROGRESS_RECID)<br />

create unique index #_#progress_recid_ident_on <br />

(PROGRESS_RECID_IDENT_)<br />

314 <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!