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.

Sample code <strong>for</strong> the db.owner.Customer table is:<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 />

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

Modifying your insert trigger<br />

4. Create a new nonunique index <strong>for</strong> each table naming the new index the same name as was<br />

dropped earlier in Step 1. Make sure it is not unique. The syntax is:<br />

Syntax<br />

CREATE INDEX ..#_#progress_recid ON<br />

(PROGRESS_RECID)<br />

A second index must be created <strong>for</strong> the PROGRESS_RECID_IDENT field. This index must be<br />

created as unique and named #_#progress_recid_ident. The syntax is:<br />

Syntax<br />

CREATE UNIQUE INDEX #_#progress_recid_ident_ ON<br />

(PROGRESS_RECID_IDENT_<br />

An example of the two indices that must be created <strong>for</strong> the customer table is as follows:<br />

CREATE INDEX customer#_#progress_recid ON CUSTOMER (PROGRESS_RECID)<br />

CREATE UNIQUE INDEX customer#_#progress_recid_ident_ ON<br />

CUSTOMER(PROGRESS_RECID_IDENT_)<br />

A–5

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

Saved successfully!

Ooh no, something went wrong!