In general, we create a database using SQL Server, and occasionally the column names in the table are incorrectly created when we create the base tables. Want to change the name of the list, there are generally many kinds of modification, but the complexity is not the same, some people to delete the entire table, re-established to achieve the modified column name ... It usually takes a lot of effort,
Here, we introduce a method that can be done directly with a statement.
For example: we have established the following table in the database
But if necessary, want to put the table China's ssex column name should be sex, use the following statement is OK:
EXEC sp_rename ' student. Ssex ', ' Sex ', ' column ';
After execution, the goal can be achieved.
That is the use of
exec sp_rename ' indicates that the original column name ', ' new column name ', ' column '
http://blog.163.com/[email protected]/blog/static/164568133201062692542258/