IF NOT EXISTS (SELECT * FROM sysobjects WHERE name = 'PISGetActivePrescriptionId')
BEGIN
CREATE TABLE [dbo].[PISGetActivePrescriptionId](
	[Id] [UNIQUEIDENTIFIER] NOT NULL,
	[PrescriptionId] [NUMERIC](18, 0) NULL,
	[Code] [VARCHAR](20) NULL,
	[IsPersonIdentifier] [BIT] NULL,
	[Status] [TINYINT] NULL,
	[ErrorMessage] [NVARCHAR](MAX) NULL,
	[CreatedOn] [DATETIME] NULL,
 CONSTRAINT [PK_PISGetActivePrescriptionID] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] 

ALTER TABLE [dbo].[PISGetActivePrescriptionId] ADD  CONSTRAINT [DF_PISGetActivePrescriptionID_Id]  DEFAULT (NEWID()) FOR [Id]
ALTER TABLE [dbo].[PISGetActivePrescriptionId] ADD  CONSTRAINT [DF_PISGetActivePrescriptionID_IsPersonIdentifier]  DEFAULT ((0)) FOR [IsPersonIdentifier]
ALTER TABLE [dbo].[PISGetActivePrescriptionId] ADD  CONSTRAINT [DF_PISGetActivePrescriptionID_Status]  DEFAULT ((0)) FOR [Status]
ALTER TABLE [dbo].[PISGetActivePrescriptionId] ADD  CONSTRAINT [DF_PISGetActivePrescriptionID_CreatedOn]  DEFAULT (GETDATE()) FOR [CreatedOn]

End


