Skip to content

Instantly share code, notes, and snippets.

@LitKnd
Created November 18, 2019 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LitKnd/53287c958b2668dffea9caf645d01d3a to your computer and use it in GitHub Desktop.
Save LitKnd/53287c958b2668dffea9caf645d01d3a to your computer and use it in GitHub Desktop.
USE tempdb;
GO
--reset demo
DROP TABLE IF EXISTS dbo.child,
dbo.parent;
GO
CREATE TABLE dbo.parent
(
i INT IDENTITY,
CONSTRAINT pk_parent PRIMARY KEY (i)
);
GO
CREATE TABLE dbo.child
(
i INT NULL,
constraint fk_child_parent FOREIGN KEY (i) REFERENCES dbo.parent(i)
);
GO
DROP TABLE dbo.parent;
GO
ALTER TABLE dbo.child NOCHECK CONSTRAINT fk_child_parent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment