Wednesday, 29 January 2014

Add Column,Constraint(Primary Key,Foreign Key) to the Existing Table

Ans:-

add column:-
alter table tbl_Emp
add col_imgid int

add primary key to the column:-
alter table tbl_Img
add primary key(col_imgid)

add foreign key to the column:-
alter table tbl_Emp
add constraint fk_key foreign key (col_imgid) references tbl_Img(col_imgid)

No comments:

Post a Comment