Dear All,
I wanted to alter a column in a table for adding both NOT NULL and PRIMARY KEY constraints to an existing column. How do I go about that.
I need your help.
First use alter table alter column for redefine column with not null, then use alter table add constraint
Code Snippet
createtable MyTable
(
id intnull,
namevarchar(100)
)
altertable MyTable altercolumn id intnotnull
altertable MyTable addconstraint pk_id primarykey(id)
No comments:
Post a Comment