Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sp_rename error "could be found"?

Tags:

sql-server

I am trying to run the following:

EXEC sp_rename '"database_name"."table_name"."old_column_name"', 'new_column_name';

But I am getting an error:

Msg 15225, Level 11, State 1, Procedure sp_rename, Line 374
No item by the name of '"database_name"."table_name"."old_column_name"' could be found in the current database 'master', given that @itemtype was input as '(null)'.
like image 223
MATH000 Avatar asked Sep 14 '25 15:09

MATH000


1 Answers

It can't properly find the column you're trying to change.

USE database_name
GO
EXEC sp_rename 'table_name.old_column_name','new_column_name','COLUMN'
GO

It works without the COLUMN object type, but added for security purposes.

Look at Microsoft's website for more info.

like image 141
BJones Avatar answered Sep 17 '25 09:09

BJones



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!