IF NOT EXISTS(SELECT * FROM Reports.dbo.rbTable WHERE TableName = 'Notebimeh')
INSERT INTO Reports.dbo.rbTable(TableName,TableAlias)
VALUES(N'Notebimeh', N'جدول بيماران'  
)

IF NOT EXISTS(SELECT * FROM Reports.dbo.rbField WHERE TableName = 'Notebimeh' AND FieldName ='Note_code')
INSERT INTO Reports.dbo.rbField(TableName,FieldName,FieldAlias,Selectable,Searchable,Sortable, DataType,AutoSearch,Mandatory)
VALUES('Notebimeh','Note_code', N'کد دفترچه', 'T','T','T','dtString', 'F','F')

IF NOT EXISTS(SELECT * FROM Reports.dbo.rbField WHERE TableName = 'Notebimeh' AND FieldName ='Meli_Card_No')
INSERT INTO Reports.dbo.rbField(TableName,FieldName,FieldAlias,Selectable,Searchable,Sortable, DataType,AutoSearch,Mandatory)
VALUES('Notebimeh','Meli_Card_No', N'کد ملي', 'T','T','T','dtString', 'F','F')

IF NOT EXISTS(SELECT * FROM Reports.dbo.rbField WHERE TableName = 'Notebimeh' AND FieldName ='Sazman_Code')
INSERT INTO Reports.dbo.rbField(TableName,FieldName,FieldAlias,Selectable,Searchable,Sortable, DataType,AutoSearch,Mandatory)
VALUES('Notebimeh','Sazman_Code', N'کد سازمان', 'T','T','T','dtString', 'F','F')

IF NOT EXISTS(SELECT * FROM Reports.dbo.rbField WHERE TableName = 'Notebimeh' AND FieldName ='Name')
INSERT INTO Reports.dbo.rbField(TableName,FieldName,FieldAlias,Selectable,Searchable,Sortable, DataType,AutoSearch,Mandatory)
VALUES('Notebimeh','Name', N'نام', 'T','T','T','dtString', 'F','F')

IF NOT EXISTS(SELECT * FROM Reports.dbo.rbField WHERE TableName = 'Notebimeh' AND FieldName ='Family')
INSERT INTO Reports.dbo.rbField(TableName,FieldName,FieldAlias,Selectable,Searchable,Sortable, DataType,AutoSearch,Mandatory)
VALUES('Notebimeh','Family', N'فاميل', 'T','T','T','dtString', 'F','F')


