USE [lib]
GO
/****** Object: Table [dbo].[AUTHER] Script Date: 7/17/2020 7:55:40 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AUTHER](
[AUTHER_ID] [int] IDENTITY(1,1) NOT NULL,
[AUTHER_NAME] [nvarchar](50) NULL,
CONSTRAINT [PK_AUTHER] PRIMARY KEY CLUSTERED
(
[AUTHER_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
USE [lib]
GO
/****** Object: Table [dbo].[DOC] Script Date: 7/17/2020 7:56:12 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DOC](
[DOC_ID] [int] IDENTITY(1,1) NOT NULL,
[DOC_NAME] [nvarchar](50) NULL,
[AUTHER_ID] [int] NULL,
[DOC_PATH] [nvarchar](50) NOT NULL,
[DOC_DATE] [date] NULL,
CONSTRAINT [PK_DOC] PRIMARY KEY CLUSTERED
(
[DOC_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DOC] WITH CHECK ADD CONSTRAINT [FK_DOC_AUTHER] FOREIGN KEY([AUTHER_ID])
REFERENCES [dbo].[AUTHER] ([AUTHER_ID])
GO
ALTER TABLE [dbo].[DOC] CHECK CONSTRAINT [FK_DOC_AUTHER]
GO
אולי צריך להגדיר בפרוצדורה RETURN?