application error in Homolog

Asked

Viewed 20 times

0

Good morning,

I am experiencing a problem in the Homolog version of the project

The index 'IX_ReqCompraId_Id' is dependent on column 'ReqCompraId'.
The object 'FK_dbo.Pedidos_dbo.ReqCompra_ReqCompraId' is dependent on column 'ReqCompraId'.
The object 'FK_dbo.Pedidos_dbo.ItemRC_ReqCompraId_Id' is dependent on column 'ReqCompraId'.
ALTER TABLE DROP COLUMN ReqCompraId failed because one or more objects access this column.

I have tried to make the following commands to rename Id2 to id but remains unsuccessful

ALTER TABLE [dbo].[Pedidos] DROP CONSTRAINT [PK_dbo.Pedidos]
GO 


EXECUTE sp_rename @objname = N'dbo.Pedidos.Id2', @newname = N'Id', @objtype = N'COLUMN' 


ALTER TABLE [dbo].[Pedidos] ADD  CONSTRAINT [PK_dbo.Pedidos] PRIMARY KEY CLUSTERED 
(
    [Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO 



CREATE NONCLUSTERED INDEX [IX_ReqCompraId_Id] ON [dbo].[Pedidos]
(
    [ReqCompraId] ASC,
    [Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO 
  • To delete the column first you need to remove dependencies. The message is very clear, you need to delete the index Ix_reqcompraid_id, as constraints by the name probably in the tables Buyout and Itemrc

  • But this error occurs when I try to run the application

  • But at the end of the error message has "ALTER TABLE DROP COLUMN Reqcompraid failed because one or more Objects access this column.", that is, the error happened because of a DROP COLOMN

  • Your application using some ORM as Entity Framework or Hibernate?

  • I’m using Entity @Ricardopunctual

  • I get it, it makes sense. Probably the column was deleted from the model, when the Entity is trying to synchronize with the database, is giving this error while running the application

  • It was deleted where you speak, no sql?

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.