Even if you get an error, make the changes.
The question is simple, instead of modifying the table from the designer, I want to do it from a query . I have found how to modify the type
, the description ... Except the name!
I have tried sp_rename
and it does not recognize the tables. Commands like Rename
, ... are not supported.
I have no useful code to show, because I have not achieved anything, I just have the table on one side and I want to give the columns new names.
I could do it by hand, but I'm curious :P
EXEC sp_RENAME 'OOEMSG.OEUSBY', 'aaaaa', 'COLUMN'
Either the @objname parameter is ambiguous or the @objtype (COLUMN) value is incorrect.
I just did a quick search and found this SO answer in English where you use the command "
sp_rename
"Remember to use single quotes to enclose the values.
See: SQL SERVER – How to Rename a Column Name or Table Name
and also: SQL SERVER - Alter table statement
Edit:
Try the following query, adding parentheses to both the table and the first parameter column, as follows:
It worked for me with the following syntax, just replace what is inside the quotes