Difference between revisions of "GETDATAMAPPING Column Constraint"

From Lianjapedia
Jump to: navigation, search
(Created page with "==Purpose== Column constraint to specify the display data mapping for a column ==Syntax== SET GETDATAMAPPING <expC> ==See Also== ALTER TABLE, SQL Constraints|CONSTRAIN...")
 
(Example)
 
Line 16: Line 16:
 
<code lang="recital">
 
<code lang="recital">
 
open database southwind
 
open database southwind
alter table "products" modify constraint supplierid set choices 'select companyname from suppliers order by companyname'
+
alter table "products" modify constraint supplierid;
alter table "products" modify constraint supplierid set getdatamapping 'keylookup("suppliers", "supplierid",{}, companyname)'
+
        set choices 'select companyname from suppliers order by companyname'
alter table "products" modify constraint supplierid set setdatamapping 'keylookup("suppliers", "companyname","{}", supplierid)'
+
alter table "products" modify constraint supplierid:
 +
        set getdatamapping 'keylookup("suppliers", "supplierid",{}, companyname)'
 +
alter table "products" modify constraint supplierid;
 +
        set setdatamapping 'keylookup("suppliers", "companyname","{}", supplierid)'
 
</code>
 
</code>
  

Latest revision as of 20:56, 28 March 2018

Purpose

Column constraint to specify the display data mapping for a column

Syntax

SET GETDATAMAPPING <expC>

See Also

ALTER TABLE, CONSTRAINTS, CREATE TABLE, Data Mapping, FIELDCHOICES(), GETDATAMAPPING(), INDEX, KEYLOOKUP(), SETDATAMAPPING(),

Description

A constraint is used to define rules that help to provide data integrity. Column constraints are specific to the column name specified. You must have ALTER privilege on the table. The table will be locked for EXCLUSIVE use during the operation.

The GETDATAMAPPING column constraint is used to specify the display data mapping for a column.

Example

open database southwind
alter table "products" modify constraint supplierid;
         set choices 'select companyname from suppliers order by companyname'
alter table "products" modify constraint supplierid:
        set getdatamapping 'keylookup("suppliers", "supplierid",{}, companyname)'
alter table "products" modify constraint supplierid;
        set setdatamapping 'keylookup("suppliers", "companyname","{}", supplierid)'