简体   繁体   中英

Rename SQL Column Error : Either the parameter @objname is ambiguous or the claimed @objtype (COLUMN) is wrong

I wanted to rename my column.

I referred this document.

I wrote a query as:

sp_RENAME '[dbo].[File].[JSONFile]', '[ARAInputJson]', 'COLUMN'

But now column is created as [ARAInputJson]

But I don't want to put square brackets to it.

So again I wrote it as :

sp_RENAME '[dbo].[File].[[ARAInputJson]]' , 'ARAInputJson', 'COLUMN'

But I get this error :

Msg 15248, Level 11, State 1, Procedure sp_rename, Line 215
Either the parameter @objname is ambiguous or the claimed @objtype (COLUMN) is wrong.

Please help me to rename column from [ARAInputJson] to ARAInputJson .

这应该可以解决方括号问题:

sp_RENAME 'dbo.File."[ARAInputJson]"' , 'ARAInputJson', 'COLUMN'

好吧删除所有那些[]并尝试

sp_RENAME 'dbo.File.[ARAInputJson]' , 'ARAInputJson', 'COLUMN'
sp_RENAME '[dbo].[File].[[ARAInputJson]]]' , 'ARAInputJson', 'COLUMN'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM