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

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

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

ALTER COLUMN: SET DEFAULT<br />

Available in: DSQL<br />

Added in: 2.0<br />

DDL statements<br />

Description: <strong>Firebird</strong> 2 adds the possibility to set/alter defaults on existing columns. If the column already had<br />

a default, the new default will replace it. Column-level defaults always override domain-level defaults.<br />

Syntax:<br />

Example:<br />

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

::= literal-value | context-variable | NULL<br />

alter table Customers alter EnteredBy set default current_user<br />

Tip<br />

If you want to switch off a domain-based default on a column, set the column default to NULL.<br />

ALTER COLUMN: POSITION now 1-based<br />

Changed in: 1.0<br />

Description: When changing a column's position, the engine now interprets the new position as 1-based. This<br />

is in accordance with the SQL standard and the InterBase documentation, but in practice InterBase interpreted<br />

the position as 0-based.<br />

Syntax:<br />

Example:<br />

ALTER TABLE tablename ALTER [COLUMN] colname POSITION <br />

::= an integer between 1 and the number of columns<br />

alter table Stock alter Quantity position 3<br />

Note<br />

Don't confuse this with the POSITION in CREATE/ALTER TRIGGER. Trigger positions are and will remain 0based.<br />

CHECK accepts NULL outcome<br />

Changed in: 2.0<br />

43

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

Saved successfully!

Ooh no, something went wrong!