clear markdown compare help donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 462254 distinct fiddles created so far.

CREATE TABLE [dbo].[keytable]( [key] [nchar](10) NOT NULL, CONSTRAINT [PK_keytable] PRIMARY KEY CLUSTERED ( [key] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY]
 hidden batch(es)


CREATE TABLE [dbo].[valuetable]( [key] [nchar](10) NULL, [value] [nchar](10) NULL ) ON [PRIMARY]
 hidden batch(es)


INSERT INTO keytable ([key]) VALUES (1),(2);
2 rows affected
 hidden batch(es)


INSERT INTO valuetable ([key],[value]) VALUES (3,'test');
1 rows affected
 hidden batch(es)


ALTER TABLE [dbo].[valuetable] WITH CHECK ADD CONSTRAINT [FK_valuetable_keytable] FOREIGN KEY([key]) REFERENCES [dbo].[keytable] ([key])
Msg 547 Level 16 State 0 Line 1 The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_valuetable_keytable". The conflict occurred in database "fiddle_819dc42f79944570be73d55b222bf753", table "dbo.keytable", column 'key'.
 hidden batch(es)


--ALTER TABLE [dbo].[valuetable] CHECK CONSTRAINT [FK_valuetable_keytable]
 hidden batch(es)