Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I solve "Either the parameter @objname is ambiguous or the claimed @objtype (COLUMN) is wrong."? [duplicate]

Tags:

sql

sql-server

If I try to execute below query:

EXEC sp_rename 'ENG_TEst.[ENG_Test_A/C_TYPE]', 'ENG_Test_AC_TYPE', 'COLUMN' 

I get an error:

Either the parameter@objname is ambiguous or the claimed @objtype (COLUMN) is wrong.

How can I solve it?

like image 311
ALEXALEXIYEV Avatar asked Jun 22 '10 08:06

ALEXALEXIYEV


2 Answers

Nuts. I hit this same error weeks ago, and after a lot of wasted time figured out how to make it work--but I've since forgotten it. (Not much help, other than to say yes, it can be done.)

Have you tried different combinations of brackets, or of with and without brackest? e.g.

EXEC sp_rename 'ENG_TEst.ENG_Test_A/C_TYPE', 'ENG_Test_AC_TYPE', 'COLUMN'; EXEC sp_rename '[ENG_TEst].[ENG_Test_A/C_TYPE]', 'ENG_Test_AC_TYPE', 'COLUMN'; EXEC sp_rename '[ENG_TEst].[ENG_Test_A/C_TYPE]', '[ENG_Test_AC_TYPE]', 'COLUMN'; EXEC sp_rename '[ENG_TEst].ENG_Test_A/C_TYPE', 'ENG_Test_AC_TYPE', 'COLUMN'; 

If all else fails, there's always

  • Create new table (as "xENG_TEst") with proper names
  • Copy data over from old table
  • Drop old table
  • Rename new table to final name
like image 152
Philip Kelley Avatar answered Sep 20 '22 07:09

Philip Kelley


This works

EXEC sp_rename  @objname = 'ENG_TEst."[ENG_Test_A/C_TYPE]"',  @newname = 'ENG_Test_A/C_TYPE',  @objtype = 'COLUMN' 
like image 45
Orlando Avatar answered Sep 18 '22 07:09

Orlando