Guest User

Untitled

a guest
Jun 1st, 2020
99
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE TABLE [dbo].[Item]
  2. (
  3.     Item_ID INT IDENTITY(1,1) NOT NULL,
  4.     Name NVARCHAR(50) NOT NULL,
  5.     CONSTRAINT PK_Item PRIMARY KEY CLUSTERED(Item_ID)
  6. );
  7.  
  8. CREATE TABLE [dbo].[Zone]
  9. (
  10.     Zone_ID INT IDENTITY(1,1) NOT NULL,
  11.     Name NVARCHAR(50) NOT NULL,
  12.     CONSTRAINT PK_Zone PRIMARY KEY CLUSTERED(Zone_ID)
  13. );
  14.  
  15. CREATE TABLE [dbo].[Item_Zone_Position]
  16. (
  17.     Item_ID INT NOT NULL,
  18.     Zone_ID INT NOT NULL,
  19.     POSITION INT NOT NULL,
  20.     CONSTRAINT PK_Item_Zone_Position PRIMARY KEY CLUSTERED(Item_ID),
  21.     CONSTRAINT FK_Item_Zone_Position_Item FOREIGN KEY(Item_ID)
  22.         REFERENCES [dbo].[Item](Item_ID),
  23.     CONSTRAINT FK_Item_Zone_Position_Zone FOREIGN KEY(Zone_ID)
  24.         REFERENCES [dbo].[Zone](Zone_ID)
  25. );
  26.  
  27. CREATE TABLE [dbo].[Item_Zone_Position_V2]
  28. (
  29.     Item_ID INT NOT NULL,
  30.     Zone_ID INT NOT NULL,
  31.     Previous_Item_ID INT NULL,
  32.     CONSTRAINT PK_Item_Zone_Position_V2 PRIMARY KEY CLUSTERED(Item_ID),
  33.     CONSTRAINT FK_Item_Zone_Position_V2_Item FOREIGN KEY(Item_ID)
  34.         REFERENCES [dbo].[Item](Item_ID),
  35.     CONSTRAINT FK_Item_Zone_Position_V2_Zone FOREIGN KEY(Zone_ID)
  36.         REFERENCES [dbo].[Zone](Zone_ID),
  37.     CONSTRAINT FK_Item_Zone_Position_V2_Item2 FOREIGN KEY(Item_ID)
  38.         REFERENCES [dbo].[Item](Item_ID)
  39. );
RAW Paste Data