Reputation: 105
I've bumped into a problem when trying to update my database. I Changed a FK and the virtual property inside my model. When I try to update the database now I'm getting this error:
Either the parameter @objname is ambiguous or the claimed @objtype (COLUMN) is wrong.
On this line code it stops the update-database:
RenameColumn("dbo.test", "test_Id", "ProgramId");
And the -verbose attribute is showing me that this line of code is giving me the error:
EXECUTE sp_rename @objname = N'dbo.test.test_Id', @newname = N'ProgramId', @objtype = N'COLUMN'
I don't know why it is giving me this error, does anyone know what is going wrong with the automatically generated migration file?
Thanks, Brent
Upvotes: 2
Views: 2843
Reputation: 139
I tried whay you said in my project which was using EF Core, I didn't get just RenameColumn in migration class, I got :
DropForeignKey(...) , DropIndex(...) , DropColumn(..) and then AddColumn(...), CreateIndex(...) and CreateForeignKey(...)
and of course worked fine when I updated database.
But I searched for your issue , it seems SQL get confused somehow, the all solutions for problems like you, were saying use [] around tableName or ColumnName, it seems you have another name like these names and SQL can't specify them.
If you just tell me more about your entities before and after changes, I can follow your footstep and get error like you.
Upvotes: 3