IF NOT EXISTS ( SELECT  *
                FROM    sysobjects
                WHERE   name = 'IRI_Prescriptions' )
    BEGIN

        CREATE TABLE [dbo].[IRI_Prescriptions]
            (
              [Id] [BIGINT] IDENTITY(1, 1)
                            NOT NULL ,
              [PrescriptionNo] [BIGINT] NULL ,
              [ContractId] [BIGINT] NULL ,
              [ContractSettingId] [INT] NULL ,
              [NationalCode] [VARCHAR](10) NULL ,
              [InsertDate] [SMALLDATETIME] NULL,
              [TransactionCode] [NVARCHAR](MAX) NULL ,
              [ErrorMessage] [NVARCHAR](MAX) NULL ,
              [ErrorCode] [VARCHAR](50) NULL ,
              [ServiceId] [BIGINT] NULL ,
              [FraudMessages] [NTEXT] NULL ,
              [ConfirmWarnFraud] [BIT] NULL ,
              [BillNumber] [NVARCHAR](200) NULL ,
              [DamageFileNumber] [NVARCHAR](200) NULL ,
              [Status] [SMALLINT] NULL ,
              CONSTRAINT [PK_IranInsurancePrescriptions] PRIMARY KEY CLUSTERED
                ( [Id] ASC )
            )
        ON  [PRIMARY]; 

        ALTER TABLE [dbo].[IRI_Prescriptions] ADD  CONSTRAINT [DF_IRI_Prescriptions_InsertDate]  DEFAULT (GETDATE()) FOR [InsertDate];

        ALTER TABLE [dbo].[IRI_Prescriptions] ADD  CONSTRAINT [DF_IRI_Prescriptions_ServiceId]  DEFAULT ((0)) FOR [ServiceId];

        ALTER TABLE [dbo].[IRI_Prescriptions] ADD  CONSTRAINT [DF_IRI_Prescriptions_confirmWarnFraud]  DEFAULT ((0)) FOR [ConfirmWarnFraud];

        ALTER TABLE [dbo].[IRI_Prescriptions] ADD  CONSTRAINT [DF_IRI_CheckObligations_Status]  DEFAULT ((0)) FOR [Status];

    END;