Thứ Bảy, 29 tháng 11, 2008

How can we change column names in database using the SQL syntax?

For Oracle 9i, the syntax is:
ALTER TABLE table_name
   RENAME COLUMN old_name to new_name;

For Microsoft SQL the syntax is:
EXEC sp_rename 'Table.[OldColumnName]', NewColumnName, 'COLUMN'
(Note here the alst terms 'COLUMN' is a must)
 
  

Không có nhận xét nào:

Đăng nhận xét