简体   繁体   English

重命名SQL列错误:参数@objname不明确或声明@objtype(COLUMN)错误

[英]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] 但是现在列被创建为[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 消息15248,级别11,状态1,过程sp_rename,行215
Either the parameter @objname is ambiguous or the claimed @objtype (COLUMN) is wrong. 参数@objname是不明确的,或者声明的@objtype(COLUMN)是错误的。

Please help me to rename column from [ARAInputJson] to ARAInputJson . 请帮我将[ARAInputJson]列重命名为ARAInputJson

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

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

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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