IF Not (EXISTS(SELECT * FROM sysobjects WHERE name='TaminPrescription'))
Begin
CREATE TABLE [dbo].[TaminPrescription](
	[Id] [uniqueidentifier] NOT NULL,
	[InsurerCode] [varchar](3) NULL,
	[BirthDate] [datetime] NULL,
	[Mobile] [varchar](12) NULL,
	[NationalCode] [varchar](12) NULL,
	[InsuredName] [nvarchar](30) NULL,
	[InsuredLastName] [nvarchar](50) NULL,
	[DoctorName] [nvarchar](max) NULL,
	[DoctorLastName] [nvarchar](max) NULL,
	[Medicalid] [int] NULL,
	[MedicalSpecialtyName] [nvarchar](max) NULL,
	[PrescriptionTypeCode] [smallint] NULL,
	[PrescriptionDate] [datetime] NULL,
	[TrackingCode] [varchar](20) NULL,
	[TotalRequestAmount] [money] NULL,
	[TotalInsurerAmount] [money] NULL,
	[TotalInsuredAmount] [money] NULL,
	[CreatedBy] [smallint] NULL,
	[CreatedOn] [datetime] NULL,
 CONSTRAINT [PK_TaminPrescription] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)
) ON [PRIMARY] 

ALTER TABLE [dbo].[TaminPrescription] ADD  CONSTRAINT [DF__TaminPrescription_Id]  DEFAULT (newid()) FOR [Id]
ALTER TABLE [dbo].[TaminPrescription] ADD  CONSTRAINT [DF__TaminPrescription_CreatedOn]  DEFAULT (getdate()) FOR [CreatedOn]
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TaminPrescription', @level2type=N'COLUMN',@level2name=N'Id'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'کد سازمان پيراميد' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TaminPrescription', @level2type=N'COLUMN',@level2name=N'InsurerCode'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'تاريخ تولد ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TaminPrescription', @level2type=N'COLUMN',@level2name=N'BirthDate'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'موبايل' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TaminPrescription', @level2type=N'COLUMN',@level2name=N'Mobile'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'کد ملي بيمار' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TaminPrescription', @level2type=N'COLUMN',@level2name=N'NationalCode'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'نام بيمار' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TaminPrescription', @level2type=N'COLUMN',@level2name=N'InsuredName'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'فاميلي بيمار' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TaminPrescription', @level2type=N'COLUMN',@level2name=N'InsuredLastName'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'نام پزشک' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TaminPrescription', @level2type=N'COLUMN',@level2name=N'DoctorName'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'فاميلي بيمار' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TaminPrescription', @level2type=N'COLUMN',@level2name=N'DoctorLastName'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'کد نظام پزشکي' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TaminPrescription', @level2type=N'COLUMN',@level2name=N'Medicalid'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'نام تخصص پزشک' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TaminPrescription', @level2type=N'COLUMN',@level2name=N'MedicalSpecialtyName'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'کد نوع نسخه' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TaminPrescription', @level2type=N'COLUMN',@level2name=N'PrescriptionTypeCode'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'تاريخ نسخه' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TaminPrescription', @level2type=N'COLUMN',@level2name=N'PrescriptionDate'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'شماره رهگيري' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TaminPrescription', @level2type=N'COLUMN',@level2name=N'TrackingCode'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'مبلغ کل درخواستي داروخانه' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TaminPrescription', @level2type=N'COLUMN',@level2name=N'TotalRequestAmount'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'مبلغ کل پرداختي سازمان' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TaminPrescription', @level2type=N'COLUMN',@level2name=N'TotalInsurerAmount'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'مبلغ کل پرداختي بيمار' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TaminPrescription', @level2type=N'COLUMN',@level2name=N'TotalInsuredAmount'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'کد کاربر' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TaminPrescription', @level2type=N'COLUMN',@level2name=N'CreatedBy'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'زمان ساخت' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TaminPrescription', @level2type=N'COLUMN',@level2name=N'CreatedOn'
End