21.10.2013 Views

Firebird 2.1 Language Reference Update

Firebird 2.1 Language Reference Update

Firebird 2.1 Language Reference Update

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

)<br />

DDL statements<br />

..<br />

constraint pk_people primary key (id),<br />

constraint uk_nickname unique (nickname) using index ix_nick<br />

alter table people<br />

add constraint fk_people_country<br />

foreign key (country) references countries(code)<br />

using desc index ix_people_country<br />

Important<br />

If you define a descending constraint-enforcing index on a primary or unique key, be sure to make any foreign<br />

keys referencing it descending as well.<br />

ALTER TABLE<br />

Available in: DSQL, ESQL<br />

ADD column: Context variables as defaults<br />

Changed in: IB<br />

Description: Any context variable that is assignment-compatible to the new column's datatype can be used as a<br />

default. This was already the case in InterBase 6, but the <strong>Language</strong> <strong>Reference</strong> only mentioned USER.<br />

Example:<br />

alter table MyData<br />

add MyDay date default current_date<br />

ALTER COLUMN: DROP DEFAULT<br />

Available in: DSQL<br />

Added in: 2.0<br />

Description: <strong>Firebird</strong> 2 adds the possibility to drop a column-level default. Once the default is dropped, there<br />

will either be no default in place or – if the column's type is a DOMAIN with a default – the domain default<br />

will resurface.<br />

Syntax:<br />

Example:<br />

ALTER TABLE tablename ALTER [COLUMN] colname DROP DEFAULT<br />

alter table Trees alter Girth drop default<br />

An error is raised if you use DROP DEFAULT on a column that doesn't have a default or whose effective default<br />

is domain-based.<br />

42

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

Saved successfully!

Ooh no, something went wrong!