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

CREATE TABLE [dbo].[IRI_InsuredContracts](
	[Id] [BIGINT] IDENTITY(1,1) NOT NULL,
	[PrescriptionId] [BIGINT] NULL,
	[TransactionCode] [NVARCHAR](MAX) NULL,
	[NationalCode] [VARCHAR](10) NULL,
	[FirstName] [NVARCHAR](30) NULL,
	[LastName] [NVARCHAR](30) NULL,
	[IsMale] [BIT] NULL,
	[FatherName] [NVARCHAR](50) NULL,
	[BirthDate] [SMALLDATETIME] NULL,
	[FamilyRelationType] [NVARCHAR](50) NULL,
	[Mobile] [VARCHAR](11) NULL,
	[FirstInsuranceCompany] [NVARCHAR](MAX) NULL,
        [FranchisePercent] [FLOAT] NULL,
	[InsuredPersonId] [BIGINT] NULL,
	[HealthContrctNumber] [NVARCHAR](50) NULL,
	[PolicyHolderName] [NVARCHAR](MAX) NULL,
	[ContractStartDate] [SMALLDATETIME] NULL,
	[ContractEndDate] [SMALLDATETIME] NULL,
	[ContractNumber] [VARCHAR](50) NULL,
	[ObligationCode] [NVARCHAR](50) NULL,
	[ObligationName] [NVARCHAR](MAX) NULL,
	[ObligationUsedAmount] [MONEY] NULL,
	[ObligationRemainedAmount] [MONEY] NULL,
	[InsertDate] [SMALLDATETIME] NULL,
 CONSTRAINT [PK_IRI_InsuredContractInformations] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)) ON [PRIMARY] 

ALTER TABLE [dbo].[IRI_InsuredContracts] ADD  CONSTRAINT [DF_IRI_InsuredContractInformations_IsMale]  DEFAULT ((0)) FOR [IsMale]
ALTER TABLE [dbo].[IRI_InsuredContracts] ADD  CONSTRAINT [DF_IRI_InsuredContracts_InsertDate]  DEFAULT (GETDATE()) FOR [InsertDate]
END