
if NOT Exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[HIO_Prescriptions]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
begin
CREATE TABLE [dbo].[HIO_Prescriptions](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[PrescriptionId] [bigint] NULL,
	[SendStatus] [tinyint] NULL,
	[InsertDate] [smalldatetime] NULL,
	[SendDate] [smalldatetime] NULL,
	[ErrorCode] [int] NULL,
	[ErrorMessage] [nvarchar](max) NULL,
	[ResultId] [bigint] NULL,
 CONSTRAINT [PK_HIO_Prescriptions] 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] TEXTIMAGE_ON [PRIMARY]



ALTER TABLE [dbo].[HIO_Prescriptions] ADD  CONSTRAINT [DF_HIO_Prescriptions_InsertDate]  DEFAULT (getdate()) FOR [InsertDate]


end


