Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 451
C Sharper Avatar asked Mar 11 '23 08:03

C Sharper


2 Answers

This should solve your square bracket issue:

sp_RENAME 'dbo.File."[ARAInputJson]"' , 'ARAInputJson', 'COLUMN'
like image 65
J.M Smith Avatar answered Mar 12 '23 23:03

J.M Smith


Well remove all those [] and try like

sp_RENAME 'dbo.File.[ARAInputJson]' , 'ARAInputJson', 'COLUMN'
like image 23
Rahul Avatar answered Mar 12 '23 23:03

Rahul