Is it possible to use function in column default value?
I want to do something like that:
CREATE TABLE FOO ( col1 varchar(100), col2 varchar(1) NOT NULL DEFAULT SUBSTRING(col1,1,1) ); Is it possible to use function in column default value?
I want to do something like that:
CREATE TABLE FOO ( col1 varchar(100), col2 varchar(1) NOT NULL DEFAULT SUBSTRING(col1,1,1) ); No, that is not possible.
Only static values are allowed and times values like current_timestamp or current_date.
You can create a VIEW of your table that uses your function to create the value.