CREATE TABLE Persons
(
P_Id int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255) DEFAULT 'Sandnes'
The above table when i created in sql i set default constraint as 'Sandnes'.after that i tried to alter as 'SANDNES' using below code.
now i want to alter the constraint ,i used the below query but it is not working.
is it possible to alter once we set default value.kindly give the reply.i reffered the tutorial site www.w3schools.com,www.tutorialpoint.com
ALTER TABLE Persons
ALTER COLUMN City SET DEFAULT 'SANDNES'
another exaple
CREATE TABLE CUSTOMERS(
ID INT NOT NULL,
NAME VARCHAR (20) NOT NULL,
AGE INT NOT NULL,
ADDRESS CHAR (25) ,
SALARY DECIMAL (18, 2) DEFAULT 5000.00,
PRIMARY KEY (ID)
);
ALTER TABLE CUSTOMERS
MODIFY SALARY DECIMAL (18, 2) DEFAULT 5000.00;