INSERT

Adds a single record to EntitySets or relationships ( ISQL option only).

Syntax

INSERT INTO object [( «field»)] VALUES(«expr1» | NULL) \
 [EVALUATE clause] [-> clause]

Parameters

object

The name of an EntitySet or relationship with fields to which you want to add a record. A role name can be used.

field

A target field in object. If more than one field is used, the names must be separated from one another by commas. If the field list is omitted, values are assigned to the fields in the order defined in the Object Dictionary.
The number of values must not exceed the number of fields. If field is omitted, it is an error to specify more values than there are fields in object.

expr1

An expression whose value is to be assigned to the corresponding field in the field list; or, if the field list is omitted, to the corresponding field in the Object Dictionary sequence.
Expressions or simple constants can be used. Any number of values can be given, separated from one another by commas. If field is omitted, it is an error to specify more values than there are fields in object.
Fields not explicitly assigned a value become $Null or take their default values. A required field that has no default value must explicitly be assigned a value (unless a SET CHECKNULLS OFF command has been issued).

NULL

This value explicitly sets the corresponding field to $Null.

Comments

INSERT adds a single record to the specified object.

Example

insert into Employees ( LastName, Salary) values ("Smith", 25000)

add Employees let LastName = "Smith" Salary = 25000

The above examples are equivalent.

The following example adds a new employee record for Fred Jones, age 36, whose salary is $30,000.

insert into Employees values ("Jones", "Fred", 36, 30000)

 

Related Topics