This isn't working in SQL Server 2008:
ALTER TABLE Employee ALTER COLUMN CityBorn SET DEFAULT 'SANDNES'
The error is:
Incorrect syntax near the keyword 'SET'.
What am I doing wrong?
This isn't working in SQL Server 2008:
ALTER TABLE Employee ALTER COLUMN CityBorn SET DEFAULT 'SANDNES'
The error is:
Incorrect syntax near the keyword 'SET'.
What am I doing wrong?
There are two scenarios where default value for a column could be changed,
Query
In this case my SQL server does not allow to modify existing default constraint value. So to change the default value we need to delete the existing system generated or user generated default constraint. And after that default value can be set for a particular column.
Follow some steps :
Execute this system database procedure, it takes table name as a parameter. It returns list of all constrains for all columns within table.
Syntax:
Syntax:
cheers @!!!
cannot use alter column for that, use add instead
This will work in SQL Server:
in case a restriction already exists with its default name: