A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
It was my bug. There was another record that was referencing value 154. The another record had ID_SFLF_NEXT = 154.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have a table
CREATE TABLE [dbo].[XG_SFLF](
[ID_SFLF] [decimal](9, 0) IDENTITY(1,1) NOT NULL,
....
[ID_SFLF_NEXT] [decimal](9, 0) NULL,
CONSTRAINT [XG_SFLF_I1] PRIMARY KEY CLUSTERED
(
[ID_SFLF] ASC
)
CREATE NONCLUSTERED INDEX [XG_SFLF_I3] ON [dbo].[XG_SFLF]
(
[ID_SFLF_NEXT] ASC
)
ALTER TABLE [dbo].[XG_SFLF] WITH CHECK ADD CONSTRAINT [XG_SFLF_FK1] FOREIGN KEY([ID_SFLF_NEXT])
REFERENCES [dbo].[XG_SFLF] ([ID_SFLF])
This table contains a chain o versions of binary data references of one document.
I wanted to delete a record where ID_SFLF was 154 and ID_SFLF_NEXT was NULL.
On dev environment I've succeded but on prod I got:
"The DELETE statement conflicted with the SAME TABLE REFERENCE contraint "XG_SFLF_FK1". The conflict occured in database "xxxx", table "dbo.XG_SFLF", column 'ID_SFLF_NEXT'
I've also tried to drop the foreign key, but got some lock error ...
Is there any advice? Could be the foreign key somehow corrupted?
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
Additional SQL Server features and topics not covered by specific categories
It was my bug. There was another record that was referencing value 154. The another record had ID_SFLF_NEXT = 154.