Organizational Research By

Surprising Reserch Topic

set a default value for an existing column in mysql


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?

asked Jun 9, 2015 in MYSQL by rajesh
0 votes
31 views



Related Hot Questions

2 Answers

0 votes
his will work in SQL Server:

ALTER TABLE Employee ADD CONSTRAINT DF_SomeName DEFAULT N'SANDNES' FOR formtable;
answered Jun 9, 2015 by rajesh
0 votes
he correct way to do this is as follows:

Run the command:

sp_help [table name]
Copy the name of the CONSTRAINT.

Drop the DEFAULT CONSTRAINT:

ALTER TABLE [table name] DROP [NAME OF CONSTRAINT]
Run the command below:

ALTER TABLE [table name] ADD DEFAULT [DEFAULT VALUE] FOR [NAME OF COLUMN]
answered Jun 9, 2015 by rajesh

...