views:

18

answers:

1

Hi,

Could somebody point out the necessary rights to do something like

ALTER TABLE myTable ADD myColumn int NOT NULL CONSTRAINT [Constraint_name] DEFAULT ((0))

?

I assumed

grant alter on myTable to [user]

was enough but I'm getting the error message

The UPDATE permission was denied on the object 'myTable', database 'x', schema 'dbo'.

Could UPDATE rights be needed because of the DEFAULT constraint?

Thanks.

+2  A: 

Yes, you need to grant the update right. Since you have the not null constraint and the default value, every row needs to be updated with 0.

klausbyskov
Thanks, that's what I was thinking but I couldn't check due to lack of rights :).
Sorin Comanescu