alter - How do I rename column in w3schools sql? -
i trying rename column name in w3schools website
alter table customers rename column contactname new_name;
however, above code throws syntax error. doing wrong?
you can try rename column in sql server:-
sp_rename 'tablename.[oldcolumnname]' , '[newcolumnname]', 'column'
sp_rename automatically renames associated index whenever primary key or unique constraint renamed. if renamed index tied primary key constraint, primary key constraint automatically renamed sp_rename. sp_rename can used rename primary , secondary xml indexes.
for mysql try this:-
alter table table_name change [column] old_col_name new_col_name
Comments
Post a Comment