December 7, 2012 at 12:42 pm
I am trying to set a default value to an existing column in a database.
Hence i try the syntax
alter table tablename
alter column columnname set default 'sand'
but it throws error.
Any help please.
Thanks
December 7, 2012 at 12:57 pm
ALTER TABLE
ADD CONSTRAINT [constraint_name] DEFAULT [default value] FOR [column]
Roland Alexander
The Monday Morning DBA
There are two means of refuge from the miseries of life: music and cats. ~ Albert Schweitzer
December 7, 2012 at 12:59 pm
what you posted is the syntax for Oracle, I believe.
SQl server is like this:
alter table TableName
add constraint df_ConstraintNAme
default 'SANDNES' for [ColumnName]
Lowell
December 7, 2012 at 1:03 pm
Thanks guys,
Worked perfectly.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply