I would like to know how to create a default value.
For example:
CREATE TABLE something
(
name varchar(20),
rank int
)
i would like to set the RANK value to 1.
(whenever i add new records, rank is automatically set to 1).
I would like to know how to create a default value.
For example:
CREATE TABLE something
(
name varchar(20),
rank int
)
i would like to set the RANK value to 1.
(whenever i add new records, rank is automatically set to 1).
If the table already exists and you want to add the default value the fastest way to do it is with ALTER TABLE
like this:
ALTER TABLE something
ALTER COLUMN rank SET DEFAULT 1;