if columnproperty(object_id('profile'),'job','columnid')  is null alter table profile add job nvarchar(15) null
alter table taraf alter column ucode bigint
alter table tarafs alter column ucode bigint
if columnproperty(object_id('khorojr'),'fshom2','columnid')  is null alter table khorojr add fshom2 float null
if columnproperty(object_id('vorodr'),'fshom2','columnid')  is null alter table vorodr add fshom2 float null
if columnproperty(object_id('khorojr'),'seri','columnid')  is null alter table khorojr add seri smallint null
if columnproperty(object_id('khorojr'),'maliat','columnid')  is null alter table khorojr add maliat float null
if columnproperty(object_id('vorodr'),'seri','columnid')  is null alter table vorodr add seri smallint null
if columnproperty(object_id('vorodr'),'maliat','columnid')  is null alter table vorodr add maliat float null
if columnproperty(object_id('khoroj'),'seri','columnid')  is null alter table khoroj add seri smallint null
if columnproperty(object_id('khoroj'),'fshom2','columnid')  is null alter table khoroj add fshom2 float null
if columnproperty(object_id('khoroj'),'tozcode2','columnid')  is null alter table khoroj add tozcode2 int null
if columnproperty(object_id('khoroj'),'tozcode3','columnid')  is null alter table khoroj add tozcode3 int null
if columnproperty(object_id('khoroj'),'fshom3','columnid')  is null alter table khoroj add fshom3 float null
if columnproperty(object_id('vorod'),'seri','columnid')  is null alter table vorod add seri smallint null
if columnproperty(object_id('vorod'),'fshom2','columnid')  is null alter table vorod add fshom2 float null
if columnproperty(object_id('vorod'),'tozcode2','columnid')  is null alter table vorod add tozcode2 int null
if columnproperty(object_id('vorod'),'tozcode3','columnid')  is null alter table vorod add tozcode3 int null
if columnproperty(object_id('vorod'),'fshom3','columnid')  is null alter table vorod add fshom3 float null
if columnproperty(object_id('kalasa'),'maliat','columnid')  is null alter table kalasa add maliat float null
if columnproperty(object_id('kala'),'maliat','columnid')  is null alter table kala add maliat float null
if columnproperty(object_id('kala'),'takh21','columnid')  is null alter table kala add takh21 float null
if columnproperty(object_id('kala'),'takh22','columnid')  is null alter table kala add takh22 float null
if columnproperty(object_id('kala'),'takh31','columnid')  is null alter table kala add takh31 float null
if columnproperty(object_id('kala'),'takh32','columnid')  is null alter table kala add takh32 float null
if columnproperty(object_id('dafvorr'),'roz1','columnid')  is null alter table dafvorr add roz1 smallint null
if columnproperty(object_id('dafvorr'),'mah1','columnid')  is null alter table dafvorr add mah1 smallint null
if columnproperty(object_id('dafvorr'),'sal1','columnid')  is null alter table dafvorr add sal1 smallint null
if columnproperty(object_id('dafvorr'),'tarikh1','columnid')  is null alter table dafvorr add tarikh1 int null
if columnproperty(object_id('dafkhorr'),'roz1','columnid')  is null alter table dafkhorr add roz1 smallint null
if columnproperty(object_id('dafkhorr'),'mah1','columnid')  is null alter table dafkhorr add mah1 smallint null
if columnproperty(object_id('dafkhorr'),'sal1','columnid')  is null alter table dafkhorr add sal1 smallint null
if columnproperty(object_id('dafkhorr'),'tarikh1','columnid')  is null alter table dafkhorr add tarikh1 int null
if columnproperty(object_id('check'),'serialbs','columnid')  is null alter table [check] add serialbs int null
if columnproperty(object_id('check'),'barat','columnid')  is null alter table [check] add barat int null
if columnproperty(object_id('bankn'),'seri','columnid')  is null alter table bankn add seri smallint null
if columnproperty(object_id('anbar'),'tcode','columnid')  is null alter table anbar add tcode int null
if columnproperty(object_id('taraf'),'toz1','columnid')  is null alter table taraf add toz1 int null
if columnproperty(object_id('taraf'),'toz2','columnid')  is null alter table taraf add toz2 int null
if columnproperty(object_id('taraf'),'toz3','columnid')  is null alter table taraf add toz3 int null
if columnproperty(object_id('taraf'),'maliat','columnid')  is null alter table taraf add maliat bit null
if columnproperty(object_id('roznameh'),'s_index2','columnid')  is null alter table roznameh add s_index2 int null
if columnproperty(object_id('conf'),'hsbonline','columnid')  is null alter table conf add hsbonline nvarchar(255) null
if columnproperty(object_id('conf'),'intg22','columnid')  is null alter table conf add intg22 int null
if columnproperty(object_id('conf'),'intg23','columnid')  is null alter table conf add intg23 int null
if columnproperty(object_id('conf'),'smspname','columnid')  is null alter table conf add smspname nvarchar(20) null
if columnproperty(object_id('conf'),'smspport','columnid')  is null alter table conf add smspport smallint null
if columnproperty(object_id('conf'),'smsfrom','columnid')  is null alter table conf add smsfrom smallint null
if columnproperty(object_id('conf'),'smsto','columnid')  is null alter table conf add smsto smallint null
if columnproperty(object_id('conf'),'smsdomain','columnid')  is null alter table conf add smsdomain nvarchar(20) null
if columnproperty(object_id('conf'),'smspass','columnid')  is null alter table conf add smspass varbinary(128) null
if columnproperty(object_id('conf'),'newcol3','columnid')  is null alter table conf add newcol3 nvarchar(15) null
if columnproperty(object_id('dafvor'),'typ','columnid')  is null alter table dafvor add typ float null
if columnproperty(object_id('dafkhor'),'typ','columnid')  is null alter table dafkhor add typ float null
if columnproperty(object_id('serial'),'tvor','columnid')  is null alter table serial add tvor int null
if columnproperty(object_id('serial'),'tkhr','columnid')  is null alter table serial add tkhr int null
if columnproperty(object_id('tolid'),'typ','columnid')  is null alter table tolid add typ nvarchar(15) null
if columnproperty(object_id('stolid'),'sodor','columnid')  is null alter table stolid add sodor nvarchar(10) null
if columnproperty(object_id('stolid'),'gindex','columnid')  is null alter table stolid add gindex int null
if columnproperty(object_id('vrfil'),'dofil','columnid')  is null alter table vrfil add dofil bit null
if columnproperty(object_id('khfil'),'dofil','columnid')  is null alter table khfil add dofil bit null
if object_id('specialrep') is null create table specialrep (sqlind int identity not null primary key ,repcode int null  ,repcode1 smallint null  ,node smallint null ,choosed bit null ,Name nvarchar(30) null ,rep varbinary(max) null)
if object_id('bijak') is null create table bijak ([sqlind] [int] IDENTITY(1,1) NOT NULL,[code] [int] NULL,[tarikh] [int] NULL,[Sal] [smallint] NULL,[Mah] [smallint] NULL,[Roz] [smallint] NULL,[fshom] [float] NULL,[shom] [float] NULL,[barbarname] [nvarchar](30) NULL,[barbaradr] [nvarchar](255) ,[ted] [int] NULL,[sharh] [nvarchar](255) NULL,[noh] [nvarchar](255) NULL,[gir] [nvarchar](30) NULL,[giradr] [nvarchar](255) NULL,[girtel] [nvarchar](30) NULL,[fer] [nvarchar](30) NULL,[hamel] [nvarchar](30) NULL,[pish] [bit] NULL,[pishmab] [float] NULL,[pishname] [nvarchar](30) NULL,[barshom] [nvarchar](10) NULL,[barroz] [smallint] NULL,[barmah] [smallint] NULL,[barsal] [smallint] NULL,[bartarikh] [int] NULL,[barsaat] [nvarchar](10) NULL,[baradr] [nvarchar](255) ,[barted] [smallint] NULL,[bartakhmahal] [nvarchar](100) ,[bartakhtel] [nvarchar](30) ,[barsh1] [nvarchar](255) NULL,[barsh2] [nvarchar](255) NULL)
if columnproperty(object_id('specialrep'),'selected','columnid') is null alter table specialrep add selected nvarchar(5) null
if columnproperty(object_id('specialrep'),'mst','columnid') is null alter table specialrep add mst bit null
if columnproperty(object_id('special1'),'kcode','columnid') is null alter table special1 add kcode int null
if columnproperty(object_id('special1'),'gkcode2','columnid')  is null alter table special1 add gkcode2 float null
if columnproperty(object_id('special1'),'gh2','columnid')  is null alter table special1 add gh2 float null
if columnproperty(object_id('special1'),'gindex','columnid')  is null alter table special1 add gindex bigint null
if object_id('daftel') is null create table daftel(sqlind int identity not null primary key,tcode int null ,name nvarchar(30) null ,tel nvarchar(60) null ,mob nvarchar(60) null ,fax nvarchar(60) null ,adr nvarchar(60) null ,adr2 nvarchar(60) null ,adr3 nvarchar(60) null ,sh ntext null ,titr nvarchar(30) null ,contact nvarchar(60) null ,email nvarchar(50) null ,ucode float null )
if object_id('history') is null create table history(sqlind int identity not null primary key,tarikh nvarchar(20),typ smallint ,act smallint ,conrec smallint null ,rec bigint null ,sh nvarchar(150) null ,shold nvarchar(100) null ,shnew nvarchar(100) null ,node smallint null ,code bigint null )
if object_id('khorsh') is null create table khorsh(sqlind int identity not null primary key,type nvarchar(10) null ,sh nvarchar(50) null )
if columnproperty(object_id('khorsh'),'webup','columnid')  is null alter table khorsh add webup bit null
if columnproperty(object_id('khorsh'),'webup1','columnid')  is null alter table khorsh add webup1 bit null
if object_id('khorsh1') is null create table khorsh1(sqlind int identity not null primary key,gindex bigint null,sqlind1 int null,sh nvarchar(255) null )
if columnproperty(object_id('khorsh1'),'webup','columnid')  is null alter table khorsh1 add webup bit null
if columnproperty(object_id('khorsh1'),'webup1','columnid')  is null alter table khorsh1 add webup1 bit null
if columnproperty(object_id('vrfil'),'ttype8','columnid')  is null alter table vrfil add ttype8 bit null
if columnproperty(object_id('khfil'),'ttype8','columnid')  is null alter table khfil add ttype8 bit null
if object_id('kala1') is null create table kala1(sqlind int identity not null primary key,kcode int null ,kcode1 int null ,ucode nvarchar(30) null ,sh nvarchar(30) null )
if columnproperty(object_id('kala1'),'webup','columnid')  is null alter table kala1 add webup bit null
if columnproperty(object_id('kala1'),'webup1','columnid')  is null alter table kala1 add webup1 bit null
if object_id('kalaphor') is null create table kalaphor(sqlind int identity not null primary key,kcode int null ,phor float null ,sath smallint null )
if columnproperty(object_id('kalaphor'),'webup','columnid')  is null alter table kalaphor add webup bit null
if columnproperty(object_id('kalaphor'),'webup1','columnid')  is null alter table kalaphor add webup1 bit null
if object_id('anbar2') is null create table anbar2(sqlind int identity not null primary key,kcode int null ,anbcode smallint null ,ted2_1 float null ,ted_1 float null ,ted2_2 float null ,ted_2 float null ,ted2_3 float null ,ted_3 float null )
if columnproperty(object_id('anbar2'),'webup','columnid')  is null alter table anbar2 add webup bit null
if columnproperty(object_id('anbar2'),'webup1','columnid')  is null alter table anbar2 add webup1 bit null
if object_id('holiday') is null create table holiday(sqlind int identity not null primary key,tarikh nvarchar(10) null ,nday smallint null ,name nvarchar(25) null )
if columnproperty(object_id('holiday'),'webup','columnid')  is null alter table holiday add webup bit null
if columnproperty(object_id('holiday'),'webup1','columnid')  is null alter table holiday add webup1 bit null
if columnproperty(object_id('holiday'),'roz','columnid')  is null alter table holiday add roz smallint null
if columnproperty(object_id('holiday'),'mah','columnid')  is null alter table holiday add mah smallint null
if columnproperty(object_id('holiday'),'sal','columnid')  is null alter table holiday add sal smallint null
if columnproperty(object_id('holiday'),'ndayname','columnid')  is null alter table holiday add ndayname nvarchar(10) null
if columnproperty(object_id('packing'),'khortar','columnid')  is null alter table packing add khortar nvarchar(10)
if columnproperty(object_id('packing'),'havtar','columnid')  is null alter table packing add havtar nvarchar(10)
alter table packing alter column vorodrgindex float
alter table packing alter column khorojrgindex bigint
alter table packing alter column havalehrgindex bigint
if columnproperty(object_id('roznameh'),'printed','columnid')  is null alter table roznameh add printed bit null
if columnproperty(object_id('roznameh'),'lastok','columnid')  is null alter table roznameh add lastok bit null
if columnproperty(object_id('profile'),'khpr1','columnid')  is null alter table profile add khpr1 smallint null
if columnproperty(object_id('profile'),'rizroz','columnid')  is null alter table profile add rizroz bit null
if columnproperty(object_id('profile'),'rozsal1','columnid')  is null alter table profile add rozsal1 smallint null
if columnproperty(object_id('profile'),'rozmah1','columnid')  is null alter table profile add rozmah1 smallint null
if columnproperty(object_id('profile'),'rozroz1','columnid')  is null alter table profile add rozroz1 smallint null
if columnproperty(object_id('profile'),'rozsal2','columnid')  is null alter table profile add rozsal2 smallint null
if columnproperty(object_id('profile'),'rozmah2','columnid')  is null alter table profile add rozmah2 smallint null
if columnproperty(object_id('profile'),'rozroz2','columnid')  is null alter table profile add rozroz2 smallint null
if columnproperty(object_id('profile'),'kghr1','columnid')  is null alter table profile add kghr1 float null
if columnproperty(object_id('profile'),'kghr2','columnid')  is null alter table profile add kghr2 float null
if columnproperty(object_id('profile'),'crm','columnid')  is null alter table profile add crm bit null
if columnproperty(object_id('repcon'),'srt3','columnid')  is null alter table repcon add srt3 smallint null
if columnproperty(object_id('repcon'),'srt4','columnid')  is null alter table repcon add srt4 smallint null
if columnproperty(object_id('repcon'),'srt1bl','columnid')  is null alter table repcon add srt1bl bit null
if columnproperty(object_id('repcon'),'srt2bl','columnid')  is null alter table repcon add srt2bl bit null
if columnproperty(object_id('repcon'),'srt3bl','columnid')  is null alter table repcon add srt3bl bit null
if columnproperty(object_id('repcon'),'srt4bl','columnid')  is null alter table repcon add srt4bl bit null
if columnproperty(object_id('repcon'),'print1','columnid')  is null alter table repcon add print1 nvarchar(100) null
if columnproperty(object_id('repcon'),'print2','columnid')  is null alter table repcon add print2 nvarchar(100) null
if columnproperty(object_id('repcon'),'print3','columnid')  is null alter table repcon add print3 nvarchar(100) null
if columnproperty(object_id('bankn'),'typ','columnid') is null alter table bankn add typ bit null
if columnproperty(object_id('dcheck'),'repno','columnid')  is null alter table dcheck add repno smallint null
if columnproperty(object_id('picture'),'f1','columnid')  is null alter table picture add f1 nvarchar(50) null
if columnproperty(object_id('picture'),'frec','columnid')  is null alter table picture add frec smallint null
if columnproperty(object_id('picture'),'f2','columnid')  is null alter table picture add f2 nvarchar(50) null
if columnproperty(object_id('picture'),'f3','columnid')  is null alter table picture add f3 nvarchar(50) null
if columnproperty(object_id('picture'),'f4','columnid')  is null alter table picture add f4 nvarchar(50) null
if columnproperty(object_id('picture'),'f5','columnid')  is null alter table picture add f5 nvarchar(50) null
if columnproperty(object_id('picture'),'f6','columnid')  is null alter table picture add f6 nvarchar(50) null
if columnproperty(object_id('picture'),'f7','columnid')  is null alter table picture add f7 nvarchar(50) null
if columnproperty(object_id('picture'),'f8','columnid')  is null alter table picture add f8 nvarchar(50) null
if columnproperty(object_id('picture'),'f9','columnid')  is null alter table picture add f9 nvarchar(50) null
if columnproperty(object_id('picture'),'f10','columnid')  is null alter table picture add f10 nvarchar(50) null
if columnproperty(object_id('picture'),'f11','columnid')  is null alter table picture add f11 nvarchar(50) null
if columnproperty(object_id('picture'),'f12','columnid')  is null alter table picture add f12 nvarchar(50) null
if object_id('tasvor') is null create table tasvor(sqlind int identity not null primary key,code int null ,type smallint null ,tasvor varbinary(max) null ) 
if columnproperty(object_id('tasvor'),'webup','columnid')  is null alter table tasvor add webup bit null
if columnproperty(object_id('tasvor'),'webup1','columnid')  is null alter table tasvor add webup1 bit null
if object_id('log1') is null create table log1(sqlind int identity not null primary key,Datetime nvarchar(20) null ,Type smallint null ,Stationno smallint null ,Userno smallint null ,Sh nvarchar(255) null )
if object_id('sefbill') is not null drop TABLE sefbill
if columnproperty(object_id('taraftel'),'sefup','columnid')  is null alter table taraftel add sefup bit 
if columnproperty(object_id('taraftel'),'sh','columnid')  is null alter table taraftel add sh nvarchar(50) null
if columnproperty(object_id('fartype'),'sefup','columnid')  is null alter table fartype add sefup bit null 
if columnproperty(object_id('kalaghroh'),'sefup','columnid')  is null alter table kalaghroh add sefup bit null
if columnproperty(object_id('kala'),'ucode2','columnid')  is null alter table kala add ucode2 nvarchar(30) null
if columnproperty(object_id('kala'),'titr1','columnid')  is null alter table kala add titr1 nvarchar(50) null
update kala set titr1=titr where titr1 is null
if columnproperty(object_id('kala'),'takhdark2','columnid')  is null alter table kala add takhdark2 float null
if columnproperty(object_id('kala'),'takhdark3','columnid')  is null alter table kala add takhdark3 float null
if columnproperty(object_id('kala'),'takhdark4','columnid')  is null alter table kala add takhdark4 float null
if columnproperty(object_id('kala'),'takhdark5','columnid')  is null alter table kala add takhdark5 float null
if columnproperty(object_id('kala'),'takhdark6','columnid')  is null alter table kala add takhdark6 float null
if columnproperty(object_id('kala'),'vahed2','columnid')  is null alter table kala add vahed2 nvarchar(25) null
if columnproperty(object_id('kala'),'vazn','columnid')  is null alter table kala add vazn float null
if columnproperty(object_id('kala'),'sefok','columnid')  is null alter table kala add sefok bit null
if columnproperty(object_id('kala'),'serok','columnid')  is null alter table kala add serok bit null
if columnproperty(object_id('kala'),'sefup','columnid')  is null alter table kala add sefup bit null
if columnproperty(object_id('kala'),'nodechecked','columnid')  is null alter table kala add nodechecked integer null
if columnproperty(object_id('kala'),'bunch','columnid')  is null alter table kala add bunch smallint null
if columnproperty(object_id('kala'),'sefmojodi','columnid')  is null begin alter table kala add sefmojodi float null update conf set intg16=0 end
if columnproperty(object_id('kala'),'tozcode','columnid')  is null alter table kala add tozcode int null
update kala set tozcode=0 where tozcode is null
if columnproperty(object_id('kala'),'arz','columnid')  is null alter table kala add arz smallint null
if columnproperty(object_id('kala'),'lep','columnid')  is null alter table kala add lep nvarchar(10) null
if columnproperty(object_id('kala'),'loc','columnid')  is null alter table kala add loc nvarchar(10) null
if columnproperty(object_id('kala'),'arzzarib','columnid')  is null alter table kala add arzzarib float null
update kala set arzzarib=1 where arzzarib is null
if columnproperty(object_id('kalasa'),'takhdark2','columnid')  is null alter table kalasa add takhdark2 float null
if columnproperty(object_id('kalasa'),'takhdark3','columnid')  is null alter table kalasa add takhdark3 float null
if columnproperty(object_id('kalasa'),'takhdark4','columnid')  is null alter table kalasa add takhdark4 float null
if columnproperty(object_id('kalasa'),'takhdark5','columnid')  is null alter table kalasa add takhdark5 float null
if columnproperty(object_id('kalasa'),'takhdark6','columnid')  is null alter table kalasa add takhdark6 float null
if columnproperty(object_id('kalasa'),'vahed','columnid')  is null alter table kalasa add vahed nvarchar(25) null
if columnproperty(object_id('kalasa'),'ghr','columnid')  is null alter table kalasa add ghr float null
if columnproperty(object_id('vorod'),'printed','columnid')  is null alter table vorod add printed bit null
if columnproperty(object_id('vorod'),'lastok','columnid')  is null alter table vorod add lastok bit null
if columnproperty(object_id('vorodr'),'kcode1','columnid')  is null alter table vorodr add kcode1 integer
if columnproperty(object_id('khorojr'),'kcode1','columnid')  is null alter table khorojr add kcode1 integer
if columnproperty(object_id('havalehr'),'kcode1','columnid')  is null alter table havalehr add kcode1 integer
if columnproperty(object_id('khoroj'),'printed','columnid')  is null alter table khoroj add printed bit null
if columnproperty(object_id('khoroj'),'lastok','columnid')  is null alter table khoroj add lastok bit null
if columnproperty(object_id('khoroj'),'returned','columnid')  is null alter table khoroj add returned float null
update khoroj set returned=0 where returned is null
if columnproperty(object_id('khoroj'),'sefstr','columnid')  is null alter table khoroj add sefstr nvarchar(10) null
if object_id('kala9') is null create table kala9(sqlind int identity not null primary key,name nvarchar(100) null )
if columnproperty(object_id('kala9'),'webup','columnid')  is null alter table kala9 add webup bit null
if columnproperty(object_id('kala9'),'webup1','columnid')  is null alter table kala9 add webup1 bit null
if object_id('kala10') is null create table kala10(sqlind int identity not null primary key,kcode int null ,kcode1 int null ,anbcode int null ,ted float null ,ted2 float null ,Sh nvarchar(50) null )
if columnproperty(object_id('autocp'),'chghr','columnid')  is null alter table autocp add chghr bit null
if columnproperty(object_id('autocp'),'ghr1','columnid')  is null alter table autocp add ghr1 float null
if columnproperty(object_id('autocp'),'ghr2','columnid')  is null alter table autocp add ghr2 float null
if columnproperty(object_id('autocp'),'p1','columnid')  is null alter table autocp add p1 bit null 
if columnproperty(object_id('autocp'),'p2','columnid')  is null alter table autocp add p2 bit null
if columnproperty(object_id('autocp'),'p3','columnid')  is null alter table autocp add p3 bit null
if columnproperty(object_id('autocp'),'p4','columnid')  is null alter table autocp add p4 bit null
if columnproperty(object_id('autocp'),'p5','columnid')  is null alter table autocp add p5 bit null
if columnproperty(object_id('autocp'),'p6','columnid')  is null alter table autocp add p6 bit null
if columnproperty(object_id('autocp'),'perb1','columnid')  is null alter table autocp add perb1 float null
if columnproperty(object_id('serial1'),'gindex','columnid')  is null alter table serial1 add gindex bigint null
if columnproperty(object_id('serial1'),'typ','columnid')  is null alter table serial1 add typ smallint null
if columnproperty(object_id('serial1'),'tarikh','columnid')  is null alter table serial1 add tarikh integer null
if columnproperty(object_id('stolid'),'tolidcode','columnid')  is null alter table stolid add tolidcode int
if columnproperty(object_id('sandog'),'sod','columnid')  is null alter table sandog add sod float null
if columnproperty(object_id('sandog'),'tcode','columnid')  is null alter table sandog add tcode integer null
if columnproperty(object_id('sandog'),'kcode','columnid')  is null alter table sandog add kcode integer null
if columnproperty(object_id('sandog'),'ojrat','columnid')  is null alter table sandog add ojrat float null
if columnproperty(object_id('sandog'),'kgh','columnid')  is null alter table sandog add kgh float null
if columnproperty(object_id('sandog'),'sod1','columnid')  is null alter table sandog add sod1 float null
if columnproperty(object_id('sandog'),'nkcode','columnid')  is null alter table sandog add nkcode integer null
if columnproperty(object_id('sandog'),'tashkildate','columnid')  is null alter table sandog add tashkildate integer null
if columnproperty(object_id('conf'),'backcolor','columnid')  is null alter table conf add backcolor nvarchar(20) null
if columnproperty(object_id('conf'),'buttoncolor','columnid')  is null alter table conf add buttoncolor nvarchar(20) null
if columnproperty(object_id('conf'),'g1fontname','columnid')  is null alter table conf add g1fontname nvarchar(50) null
if columnproperty(object_id('conf'),'g1fontsize','columnid')  is null alter table conf add g1fontsize smallint null
if columnproperty(object_id('conf'),'g1fontstyle','columnid')  is null alter table conf add g1fontstyle nvarchar(9) null
if columnproperty(object_id('conf'),'g1fontcolor','columnid')  is null alter table conf add g1fontcolor nvarchar(20) null
if columnproperty(object_id('conf'),'sefhes','columnid')  is null alter table conf add sefhes int null
if columnproperty(object_id('conf'),'sefuser','columnid')  is null alter table conf add sefuser int null
if columnproperty(object_id('conf'),'sefpass','columnid')  is null alter table conf add sefpass varbinary(128) null
if columnproperty(object_id('conf'),'newcol4','columnid')  is null alter table conf add newcol4 nvarchar(10) null
if columnproperty(object_id('conf'),'copmint','columnid')  is null alter table conf add copmint nvarchar(30) null
if columnproperty(object_id('conf'),'mal1','columnid')  is null alter table conf add mal1 float null
if columnproperty(object_id('conf'),'mal2','columnid')  is null alter table conf add mal2 float null
if columnproperty(object_id('conf'),'sepasuser','columnid')  is null alter table conf add sepasuser int null
if columnproperty(object_id('conf'),'sepaspass','columnid')  is null alter table conf add sepaspass varbinary(128) null
if columnproperty(object_id('conf'),'newcol5','columnid')  is null alter table conf add newcol5 nvarchar(10) null
if columnproperty(object_id('conf'),'ostan','columnid')  is null alter table conf add ostan nvarchar(50) null
if columnproperty(object_id('conf'),'shahrestan','columnid')  is null alter table conf add shahrestan nvarchar(50) null
if columnproperty(object_id('conf'),'codeposti','columnid')  is null alter table conf add codeposti nvarchar(50) null
if columnproperty(object_id('conf'),'shahr','columnid')  is null alter table conf add shahr nvarchar(50) null
if columnproperty(object_id('conf'),'meli','columnid')  is null alter table conf add meli nvarchar(15) null
if columnproperty(object_id('conf'),'shahrcode','columnid')  is null alter table conf add shahrcode int null
if columnproperty(object_id('conf'),'ostancode','columnid')  is null alter table conf add ostancode int null
if columnproperty(object_id('conf'),'regno','columnid')  is null alter table conf add regno nvarchar(13) null
if columnproperty(object_id('conf'),'edarehcode','columnid')  is null alter table conf add edarehcode smallint null
if columnproperty(object_id('conf'),'username','columnid')  is null alter table conf add username nvarchar(20) null
if columnproperty(object_id('conf'),'band','columnid')  is null alter table conf add band smallint null
if columnproperty(object_id('conf'),'sabtenam','columnid')  is null alter table conf add sabtenam smallint null
if columnproperty(object_id('conf'),'dar1','columnid')  is null alter table conf add dar1 float null
if columnproperty(object_id('conf'),'dar2','columnid')  is null alter table conf add dar2 float null
if columnproperty(object_id('conf'),'dar3','columnid')  is null alter table conf add dar3 float null
if columnproperty(object_id('conf'),'anbroz','columnid')  is null alter table conf add anbroz smallint null
if columnproperty(object_id('conf'),'anbmah','columnid')  is null alter table conf add anbmah smallint null
if columnproperty(object_id('conf'),'anbsal','columnid')  is null alter table conf add anbsal smallint null
if columnproperty(object_id('conf'),'smsurl','columnid')  is null alter table conf add smsurl nvarchar(30) null
if columnproperty(object_id('conf'),'crmpath','columnid')  is null alter table conf add crmpath nvarchar(200) null
if columnproperty(object_id('conf'),'webhes','columnid')  is null alter table conf add webhes int null
if columnproperty(object_id('conf'),'webuser','columnid')  is null alter table conf add webuser int null
if columnproperty(object_id('conf'),'webpass','columnid')  is null alter table conf add webpass varbinary(128) null
if columnproperty(object_id('conf'),'newcol6','columnid')  is null alter table conf add newcol6 nvarchar(10) null
if columnproperty(object_id('conf'),'boolvar1','columnid')  is null alter table conf add boolvar1 nvarchar(255) null
if columnproperty(object_id('conf'),'modir','columnid')  is null alter table conf add modir nvarchar(100) null
if columnproperty(object_id('conf'),'irani','columnid')  is null alter table conf add irani bit null
if columnproperty(object_id('conf'),'mobileno','columnid')  is null alter table conf add mobileno nvarchar(11) null
if columnproperty(object_id('taraf'),'payamak','columnid')  is null alter table taraf add payamak bit null
if columnproperty(object_id('taraf'),'sefok','columnid')  is null alter table taraf add sefok bit null
if columnproperty(object_id('taraf'),'sefbillok','columnid')  is null alter table taraf add sefbillok bit null
if columnproperty(object_id('taraf'),'sefup','columnid')  is null alter table taraf add sefup bit null
if columnproperty(object_id('taraf'),'ostan','columnid')  is null alter table taraf add ostan nvarchar(50) null
if columnproperty(object_id('taraf'),'shahrestan','columnid')  is null alter table taraf add shahrestan nvarchar(50) null
if columnproperty(object_id('taraf'),'codeposti','columnid')  is null alter table taraf add codeposti nvarchar(50) null
if columnproperty(object_id('taraf'),'shahr','columnid')  is null alter table taraf add shahr nvarchar(50) null
if columnproperty(object_id('taraf'),'meli','columnid')  is null alter table taraf add meli nvarchar(15) null
if columnproperty(object_id('taraf'),'nodechecked','columnid')  is null alter table taraf add nodechecked integer null
if columnproperty(object_id('taraf'),'spc1','columnid')  is null alter table taraf add spc1 float null
if columnproperty(object_id('taraf'),'spc2','columnid')  is null alter table taraf add spc2 float null
if columnproperty(object_id('taraf'),'spc3','columnid')  is null alter table taraf add spc3 float null
if columnproperty(object_id('taraf'),'spc4','columnid')  is null alter table taraf add spc4 float null
if columnproperty(object_id('taraf'),'sefendvas','columnid')  is null alter table taraf add sefendvas float null
if columnproperty(object_id('taraf'),'pos','columnid')  is null alter table taraf add pos smallint null
if columnproperty(object_id('taraf'),'shahrcode','columnid')  is null alter table taraf add shahrcode int null
if columnproperty(object_id('taraf'),'ostancode','columnid')  is null alter table taraf add ostancode int null
if columnproperty(object_id('taraf'),'n1','columnid')  is null alter table taraf add n1 smallint null
if columnproperty(object_id('taraf'),'n2','columnid')  is null alter table taraf add n2 smallint null
if columnproperty(object_id('taraf'),'anbcode','columnid')  is null alter table taraf add anbcode smallint null
if object_id('khmisc') is null create table khmisc(sqlind int identity not null primary key,fcode int null ,pr smallint null ) 
if columnproperty(object_id('khmisc'),'webup','columnid')  is null alter table khmisc add webup bit null
if columnproperty(object_id('khmisc'),'webup1','columnid')  is null alter table khmisc add webup1 bit null
if columnproperty(object_id('khmisc'),'pr1','columnid')  is null alter table khmisc add pr1 smallint null 
if columnproperty(object_id('khmisc'),'typ','columnid')  is null alter table khmisc add typ smallint null
if columnproperty(object_id('khmisc'),'saat','columnid')  is null alter table khmisc add saat nvarchar(20) null 
if object_id('serialnew') is null create table serialnew(sqlind int identity not null primary key,[Kcode] [int] NULL,[sqlind1] [int] NULL,[Serial] [float] NULL,[gindex] [bigint] NULL,[gindex1] [bigint] NULL,[typ] [smallint] NULL,[anbcode] [smallint] NULL,[tarikh] [int] NULL)
if columnproperty(object_id('serialnew'),'webup','columnid')  is null alter table serialnew add webup bit null
if columnproperty(object_id('serialnew'),'webup1','columnid')  is null alter table serialnew add webup1 bit null
if columnproperty(object_id('serialnew'),'sqlind1','columnid')  is null alter table serialnew add sqlind1 integer null
if columnproperty(object_id('serialnew'),'gindex1','columnid')  is null alter table serialnew add gindex1 bigint null
if columnproperty(object_id('sandog'),'aks','columnid') is not null alter table sandog drop column aks
if object_id('jav') is null create table jav(sqlind int identity not null primary key,code int null ,tarikh1 int null ,Sal1 smallint null ,Mah1 smallint null ,Roz1 smallint null ,vazn1 float null ,tcode int null ,kcode int null ,kvazn float null ,kted float null ,kted2 float null ,kgh1 float null ,kojrat1 float null ,ghkol1 float null ,fanb smallint null ,tarikh2 int not null ,Sal2 smallint null ,Mah2 smallint null ,Roz2 smallint null ,vazn2 float null ,kgh2 float null ,kojrat2 float null ,ghkol2 float null ,kasry float null ,darsad float null ,ghkol float null )
if columnproperty(object_id('jav'),'webup','columnid')  is null alter table jav add webup bit null
if columnproperty(object_id('jav'),'webup1','columnid')  is null alter table jav add webup1 bit null
if columnproperty(object_id('jav'),'kvazn2','columnid') is null alter table jav add kvazn2 float null
if columnproperty(object_id('jav'),'tlcode','columnid') is null alter table jav add tlcode float null
if object_id('javpre') is null create table javpre (sqlind int identity not null primary key,tcode int null ,kcode int null ,kname nvarchar(50) null ,gh1 float null ,gh2 float null )
if columnproperty(object_id('javpre'),'webup','columnid')  is null alter table javpre add webup bit null
if columnproperty(object_id('javpre'),'webup1','columnid')  is null alter table javpre add webup1 bit null
if object_id('sms') is null create table sms(sqlind int identity not null primary key,mobile nvarchar(15) null ,sh nvarchar(1000) null ,tarikh1 nvarchar(25) null ,tarikh2 nvarchar(25) null ,tarikh3 nvarchar(25) null ,mab smallint null ,node1 int null ,node2 int null ,tcode int null ,peygiri int null)
if columnproperty(object_id('sms'),'webup','columnid')  is null alter table sms add webup bit null
if columnproperty(object_id('sms'),'webup1','columnid')  is null alter table sms add webup1 bit null
alter table sms alter column peygiri bigint
if columnproperty(object_id('sms'),'rectype','columnid') is null alter table sms add rectype smallint null
if columnproperty(object_id('sms'),'recno','columnid') is null alter table sms add recno bigint null
if columnproperty(object_id('sms'),'nodechecked','columnid') is null alter table sms add nodechecked integer null
if object_id('talgh') is null create table talgh(sqlind int identity not null primary key,sal int null ,mah int null ,roz int null ,tarikh int null ,gh float null )
if columnproperty(object_id('talgh'),'webup','columnid')  is null alter table talgh add webup bit null
if columnproperty(object_id('talgh'),'webup1','columnid')  is null alter table talgh add webup1 bit null
if object_id('crm') is null create table crm (sqlind int identity not null primary key,tcode int null,node1 smallint null ,tarikh1 nvarchar(25) null,sh1 nvarchar(512) null ,media smallint null ,urg smallint null ,typ1 smallint null ,typ2 smallint null,typ3 smallint null ,subject nvarchar(20) null ,tarikh2 nvarchar(25)  null,node2 smallint null ,tarikh3 nvarchar(25)  null,sh2 nvarchar(512) null ,tarikh4 nvarchar(25)  null,tarikh5 nvarchar(25)  null ,node smallint null ,seen1 bit null ,seen2 bit null ,peygiri int null)
if columnproperty(object_id('crm'),'webup','columnid') is null alter table crm add webup bit null
if columnproperty(object_id('crm'),'webup1','columnid') is null alter table crm add webup1 bit null
if columnproperty(object_id('crm'),'attach','columnid') is null alter table crm add attach bit null
update crm set attach=0 where attach is null
if object_id('crmtypes') is null create table crmtypes (sqlind int identity not null primary key,code int null ,name nvarchar(25) null ,node smallint null ,urgday smallint null)
if columnproperty(object_id('crmtypes'),'webup','columnid')  is null alter table crmtypes add webup bit null
if columnproperty(object_id('crmtypes'),'webup1','columnid')  is null alter table crmtypes add webup1 bit null
if object_id('netlock') is null create table netlock (sqlind int identity not null primary key,nettbname nvarchar(20) null ,netkeyname nvarchar(20) null ,netkeyvalue nvarchar(20) null ,node int null)
if object_id('tarafghroh') is null create table tarafghroh (sqlind int identity not null primary key,code int null,name nvarchar(30) null ,ucode float null,node float null,ghr1 float null,ghr2 float null,ghr3 float null,ghr4 float null,ghr5 float null,ghr6 float null,ghr7 float null,ghr8 float null,ghr9 float null,ghr10 float null,webup bit null)
if columnproperty(object_id('tarafghroh'),'webup1','columnid') is null alter table tarafghroh add webup1 bit null
if object_id('arzgh') is null create table arzgh(sqlind int identity not null primary key,sal int null,mah int null,roz int null,tarikh int null,gh float null,arzcode float null,z1 float null,z2 float null)
if object_id('webdelete') is null create table webdelete(sqlind int identity not null primary key,dbname nvarchar(30) null,fname nvarchar(30) null ,fvalue bigint null)
if columnproperty(object_id('tasvor'),'sefup','columnid')  is null alter table tasvor add sefup bit
if object_id('kalajav') is null CREATE TABLE kalajav(sqlind int identity not null primary key,kcode int null,scode int null,vazn float null)
if object_id('tahvil') is null CREATE TABLE tahvil(sqlind int identity not null primary key,ucode nvarchar(30) null,kcode int null,ted int null,fcode int null)
if columnproperty(object_id('taraf'),'sefmojok','columnid')  is null alter table taraf add sefmojok bit
if columnproperty(object_id('taraf'),'sefmanok','columnid')  is null alter table taraf add sefmanok bit
if columnproperty(object_id('roznameh'),'nodechecked','columnid')  is null alter table roznameh add nodechecked integer null
if columnproperty(object_id('vorod'),'nodechecked','columnid')  is null alter table vorod add nodechecked integer null
if columnproperty(object_id('khoroj'),'nodechecked','columnid')  is null alter table khoroj add nodechecked integer null
if columnproperty(object_id('roznameh'),'tickbes','columnid')  is null alter table roznameh add tickbes bit null
if columnproperty(object_id('tashim2'),'typ','columnid')  is null alter table tashim2 add typ nvarchar(10) null
if columnproperty(object_id('gtcode'),'sefup','columnid')  is null alter table gtcode add sefup bit null 
if object_id('stabdilazad') is null CREATE TABLE [dbo].[stabdilazad](sqlind int identity not null primary key,[Roz] [smallint] NULL,[Mah][smallint] NULL,[Sal] [smallint] NULL,[Tarikh] [int] NULL,[Sh] [nvarchar](60) NULL,[Ticked] [bit] NULL,[Checked] [bit] NULL,[Node] [float] NULL,[Project] [smallint] NULL,[s_unique] [float] NULL,[Fshom] [float] NULL,[webup] [bit] NULL)
if columnproperty(object_id('stabdilazad'),'webup1','columnid')  is null alter table stabdilazad add webup1 bit null
if object_id('stabdilazadr') is null CREATE TABLE [dbo].[stabdilazadr]([gindex] [bigint] NOT NULL primary key,[s_Index] [int] NULL,[Fcode] [int] NULL,[Anbcode1] [int] NULL,[Kcode1] [int] NULL,[Ted1] [float] NULL,[Gh1] [float] NULL,[Anbcode2] [int] NULL,[Kcode2] [int] NULL,[Ted2] [float] NULL,[Gh2] [float] NULL,[Ticked] [bit] NULL,[Checked] [bit] NULL,[Sh] [nvarchar](50) NULL,[Project] [smallint] NULL,[Node] [float] NULL,[webup] [bit] NULL)
if columnproperty(object_id('stabdilazadr'),'webup1','columnid')  is null alter table stabdilazadr add webup1 bit null
if object_id('calender') is null CREATE TABLE [dbo].[calender]([sqlind] [int] IDENTITY(1,1) NOT NULL,[roz] [smallint] NULL,[mah] [smallint] NULL,[sal] [smallint] NULL,[tarikh] [int] NULL,[sh] [nvarchar](255) NULL,[type] [nvarchar](15) NULL,[node] [smallint] NULL,	[darad] [nvarchar](5) NULL,[webup] [bit] NULL)
if columnproperty(object_id('calender'),'webup1','columnid')  is null alter table calender add webup1 bit null
if columnproperty(object_id('calender'),'nodeto','columnid')  is null alter table calender add nodeto smallint null
update calender set nodeto=node where nodeto is null
if columnproperty(object_id('calender'),'nodetoname','columnid')  is null alter table calender add nodetoname nvarchar(25) null
alter table repcon1 alter column tcaption1 nvarchar(20)
alter table repcon1 alter column tcaption2 nvarchar(20)
alter table repcon1 alter column tcaption3 nvarchar(20)
alter table repcon1 alter column tcaption4 nvarchar(20)
alter table repcon1 alter column tcaption5 nvarchar(20)
alter table repcon1 alter column tcaption6 nvarchar(20)
alter table repcon1 alter column tcaption7 nvarchar(20)
alter table repcon1 alter column tcaption8 nvarchar(20)
alter table repcon1 alter column tcaption9 nvarchar(20)
alter table repcon1 alter column tcaption10 nvarchar(20)
alter table repcon1 alter column tcaption11 nvarchar(20)
alter table repcon1 alter column tcaption12 nvarchar(20)
alter table repcon1 alter column tcaption13 nvarchar(20)
alter table repcon1 alter column tcaption14 nvarchar(20)
alter table repcon1 alter column tcaption15 nvarchar(20)
alter table repcon1 alter column tcaption16 nvarchar(20)
if object_id('ticket') is null CREATE TABLE ticket([sqlind] [int] IDENTITY(1,1) NOT NULL,[serial] [int] NOT NULL,[subserial] [int] NULL,	[subject] [nvarchar](100),[owner] [int] NULL,[count] [smallint] NULL,[ownername] [nvarchar](50) NULL,[dt] [nvarchar](30) NULL,	[type] [nvarchar](50) NULL,[city] [nvarchar](50) NULL,[dep] [nvarchar](50) NULL,[program] [nvarchar](50) NULL,[depcode] [smallint] NULL,[programcode] [smallint] NULL,[sh] [ntext] NULL,[whosee] [nvarchar](4) NULL,[howdo] [smallint] NULL,[closed] [nvarchar](15) NULL,[howdosh] [nvarchar](50) NULL,[sqlindsite] [int] NULL,[dtup] [nvarchar](30) NULL,[doit] [bit] NULL,[node] [float] NULL,[fname] [nvarchar](255) NULL,[webup] [bit] NULL)
if columnproperty(object_id('ticket'),'webup1','columnid')  is null alter table ticket add webup1 bit null
alter table [check] alter column shom bigint
alter table [dcheck] alter column shomf bigint
alter table [resid2] alter column shom bigint
alter table [barg] alter column shom bigint
alter table [khfil] alter column fshom1 bigint
alter table [khfil] alter column fshom2 bigint
alter table [khfil] alter column fshom21 bigint
alter table [khfil] alter column fshom22 bigint
alter table [vrfil] alter column fshom1 bigint
alter table [vrfil] alter column fshom2 bigint
alter table [vrfil] alter column fshom21 bigint
alter table [vrfil] alter column fshom22 bigint
if columnproperty(object_id('special1'),'sefup','columnid')  is null alter table special1 add sefup bit
if columnproperty(object_id('taraf'),'toznewcode','columnid')  is null alter table taraf add toznewcode int
if columnproperty(object_id('taraf'),'toznewcode1','columnid')  is null alter table taraf add toznewcode1 int
if columnproperty(object_id('calender'),'darad','columnid')  is null alter table calender add darad nvarchar(5)
alter table [crm] alter column typ2 int
alter table [crm] alter column typ3 int
if columnproperty(object_id('profile'),'tghr1','columnid')  is null alter table profile add tghr1 float null
if columnproperty(object_id('profile'),'tghr2','columnid')  is null alter table profile add tghr2 float null
if columnproperty(object_id('tarafs'),'ghr','columnid')  is null alter table tarafs add ghr float null
if columnproperty(object_id('vrfil'),'ftype9','columnid')  is null alter table vrfil add ftype9 bit null
if columnproperty(object_id('khfil'),'ftype9','columnid')  is null alter table khfil add ftype9 bit null
if columnproperty(object_id('vorodr'),'tam1','columnid')  is null alter table vorodr add tam1 tinyint null
if columnproperty(object_id('vorodr'),'tam2','columnid')  is null alter table vorodr add tam2 tinyint null
if columnproperty(object_id('vorodr'),'tam3','columnid')  is null alter table vorodr add tam3 tinyint null
if columnproperty(object_id('taraf'),'crsal','columnid')  is null alter table taraf add crsal integer null
if columnproperty(object_id('taraf'),'crmah','columnid')  is null alter table taraf add crmah tinyint null
if columnproperty(object_id('taraf'),'crroz','columnid')  is null alter table taraf add crroz tinyint null
update taraf set crsal=0 where crsal is null
update taraf set crmah=0 where crmah is null
update taraf set crroz=0 where crroz is null
if object_id('vorodrr') is null create table vorodrr(gindex bigint primary key ,[roz] [tinyint] NULL,[mah] [tinyint] NULL,[sal] [int] NULL,[Fcode] [int] NULL,[Kcode] [int] NULL,[Ted] [float] NULL,[gh] [float] NULL,[Sh] [nvarchar](50),[s_Index] [int] NULL,[Ticked] [bit] NULL,[Checked] [bit] NULL,[Anbcode] [int] NULL,[Tarikh] [int] NULL,[Node] [float] NULL,[s_Unique] [float] NULL,[webup] [bit] NULL,[tam2] [tinyint] NULL,maliat [float] null)
if columnproperty(object_id('vorodr'),'tam4','columnid')  is null alter table vorodr add tam4 int null
if columnproperty(object_id('vorodr'),'webup1','columnid')  is null alter table vorodr add webup1 bit null
update vorodr set tam1=0 where tam1 is null
update vorodr set tam2=0 where tam2 is null
update vorodr set tam3=0 where tam3 is null
update vorodr set tam4=0 where tam4 is null
if columnproperty(object_id('khfil'),'roz1','columnid')  is null alter table khfil add roz1 tinyint null
if columnproperty(object_id('khfil'),'mah1','columnid')  is null alter table khfil add mah1 tinyint null
if columnproperty(object_id('khfil'),'sal1','columnid')  is null alter table khfil add sal1 smallint null
if columnproperty(object_id('khfil'),'roz2','columnid')  is null alter table khfil add roz2 tinyint null
if columnproperty(object_id('khfil'),'mah2','columnid')  is null alter table khfil add mah2 tinyint null
if columnproperty(object_id('khfil'),'sal2','columnid')  is null alter table khfil add sal2 smallint null
if columnproperty(object_id('vrfil'),'roz1','columnid')  is null alter table vrfil add roz1 tinyint null
if columnproperty(object_id('vrfil'),'mah1','columnid')  is null alter table vrfil add mah1 tinyint null
if columnproperty(object_id('vrfil'),'sal1','columnid')  is null alter table vrfil add sal1 smallint null
if columnproperty(object_id('vrfil'),'roz2','columnid')  is null alter table vrfil add roz2 tinyint null
if columnproperty(object_id('vrfil'),'mah2','columnid')  is null alter table vrfil add mah2 tinyint null
if columnproperty(object_id('vrfil'),'sal2','columnid')  is null alter table vrfil add sal2 smallint null
if columnproperty(object_id('vrfil'),'tarch','columnid')  is null alter table vrfil add tarch bit null
if columnproperty(object_id('khfil'),'tarch','columnid')  is null alter table khfil add tarch bit null
if columnproperty(object_id('conf'),'gsmmodem','columnid')  is null alter table conf add gsmmodem nvarchar(50) null
if columnproperty(object_id('serial1'),'tamircode','columnid')  is null alter table serial1 add tamircode int null
if columnproperty(object_id('khortoz'),'tamircode','columnid')  is null alter table khortoz add tamircode bigint null
alter table [serial1] alter column tamircode bigint
if columnproperty(object_id('kala'),'tamircode','columnid')  is null alter table kala add tamircode int null
alter table taraf alter column titr nvarchar(60)
alter table tarafs alter column titr nvarchar(60)
alter table daftel alter column titr nvarchar(60)
alter table bijak alter column fer nvarchar(60)
if columnproperty(object_id('vorodr'),'takh','columnid')  is null alter table vorodr add takh float
if columnproperty(object_id('khorojr'),'takh','columnid')  is null alter table khorojr add takh float
update vorodr set takh=0 where takh is null
update khorojr set takh=0 where takh is null
if columnproperty(object_id('kalasa'),'exptarikh','columnid') is null exec sp_rename 'kalasa.exp', 'exptarikh', 'COLUMN'
alter table [crm] alter column typ2 bigint
alter table [kala] alter column loc nvarchar(30)
if columnproperty(object_id('kala'),'visloc','columnid')  is null alter table kala add visloc int null
if columnproperty(object_id('vorodr'),'tam5','columnid')  is null alter table vorodr add tam5 int null
update vorodr set tam5=0 where tam5 is null
if columnproperty(object_id('vorodr'),'tam6','columnid')  is null alter table vorodr add tam6 int null
update vorodr set tam6=0 where tam6 is null
if columnproperty(object_id('kala'),'keyw','columnid')  is null alter table kala add keyw nvarchar(50)
update kala set keyw='' where keyw is null
if columnproperty(object_id('kala'),'keyghr','columnid')  is null alter table kala add keyghr nvarchar(50)
update kala set keyghr='' where keyghr is null
if columnproperty(object_id('profile'),'tozcode','columnid')  is null alter table profile add tozcode int null
update profile set tozcode=0 where tozcode is null
if columnproperty(object_id('profile'),'bankcode','columnid')  is null alter table profile add bankcode int null
update profile set bankcode=0 where bankcode is null
if columnproperty(object_id('taraf'),'card','columnid')  is null alter table taraf add card nvarchar(16) null
update taraf set card='' where card is null
if columnproperty(object_id('webdelete'),'webup','columnid')  is null alter table webdelete add webup bit null
update webdelete set webup=0 where webup is null
if columnproperty(object_id('dafkhorr'),'jar','columnid')  is null alter table dafkhorr add jar float null
update dafkhorr set jar=0 where jar is null
if columnproperty(object_id('dafvorr'),'jar','columnid')  is null alter table dafvorr add jar float null
update dafvorr set jar=0 where jar is null
if columnproperty(object_id('stabdilazadr'),'roz1','columnid')  is null alter table stabdilazadr add roz1 smallint null
update stabdilazadr set roz1=0 where roz1 is null
if columnproperty(object_id('stabdilazadr'),'mah1','columnid')  is null alter table stabdilazadr add mah1 smallint null
update stabdilazadr set mah1=0 where mah1 is null
if columnproperty(object_id('stabdilazadr'),'sal1','columnid')  is null alter table stabdilazadr add sal1 smallint null
update stabdilazadr set sal1=0 where sal1 is null
if columnproperty(object_id('stabdilazadr'),'tarikh1','columnid')  is null alter table stabdilazadr add tarikh1 int null
update stabdilazadr set tarikh1=0 where tarikh1 is null
if columnproperty(object_id('stabdilazadr'),'roz2','columnid')  is null alter table stabdilazadr add roz2 smallint null
update stabdilazadr set roz2=0 where roz2 is null
if columnproperty(object_id('stabdilazadr'),'mah2','columnid')  is null alter table stabdilazadr add mah2 smallint null
update stabdilazadr set mah2=0 where mah2 is null
if columnproperty(object_id('stabdilazadr'),'sal2','columnid')  is null alter table stabdilazadr add sal2 smallint null
update stabdilazadr set sal2=0 where sal2 is null
if columnproperty(object_id('stabdilazadr'),'tarikh2','columnid')  is null alter table stabdilazadr add tarikh2 int null
update stabdilazadr set tarikh2=0 where tarikh2 is null
if columnproperty(object_id('special1'),'name2','columnid')  is null alter table special1 add name2 nvarchar(30) null
update special1 set name2='' where name2 is null
if columnproperty(object_id('taraf'),'ramz','columnid')  is null alter table taraf add ramz nvarchar(20) null
update taraf set ramz='' where ramz is null
if object_id('bonus') is null begin create table bonus (sqlind int identity not null primary key,tcode int null,roz smallint null,mah smallint null,sal smallint null,tarikh int null,khfshom float null,vrfshom float null,num1 int null,num2 int null,num3 int null,num4 int null,num5 int null,sh nvarchar(50) null,sh1 nvarchar(50) null,sh2 nvarchar(50) null,sh3 nvarchar(50) null,bed float null,bes float null,mandeh float null,vassh nvarchar(4) null,node smallint null,ticked bit null) update conf set intg14=0,intg18=0 end
if columnproperty(object_id('bonus'),'bool1','columnid')  is null alter table bonus add bool1 bit null
update bonus set bool1=0 where bool1 is null
if columnproperty(object_id('bonus'),'bool2','columnid')  is null alter table bonus add bool2 bit null
update bonus set bool2=0 where bool2 is null
if columnproperty(object_id('bonus'),'bool3','columnid')  is null alter table bonus add bool3 bit null
update bonus set bool3=0 where bool3 is null
if columnproperty(object_id('bonus'),'bool4','columnid')  is null alter table bonus add bool4 bit null
update bonus set bool4=0 where bool4 is null
if columnproperty(object_id('bonus'),'bool5','columnid')  is null alter table bonus add bool5 bit null
update bonus set bool5=0 where bool5 is null
if columnproperty(object_id('taraf'),'n3','columnid')  is null alter table taraf add n3 tinyint null
update taraf set n3=0 where n3 is null
if columnproperty(object_id('kala'),'hesab','columnid')  is null alter table kala add hesab tinyint null
update kala set hesab=0 where hesab is null
alter table repcon alter column datafontsize smallint
alter table repcon alter column dtfontsize smallint
alter table repcon alter column specfontsize smallint
alter table repcon alter column srt1 smallint
alter table repcon alter column srt2 smallint
alter table repcon1 alter column width1 float
if columnproperty(object_id('conf'),'branchid','columnid')  is null alter table conf add branchid smallint null
if columnproperty(object_id('conf'),'lastbranchup','columnid')  is null alter table conf add lastbranchup nvarchar(10) null
if columnproperty(object_id('kala'),'bid','columnid')  is null begin alter table kala add bid smallint null exec('update kala set bid=0 where bid is null') end
if columnproperty(object_id('havaleh'),'bid','columnid')  is null begin alter table havaleh add bid smallint null exec('update havaleh set bid=0 where bid is null') end
if columnproperty(object_id('khoroj'),'bid','columnid')  is null begin alter table khoroj add bid smallint null exec('update khoroj set bid=0 where bid is null') end
if columnproperty(object_id('taraf'),'bid','columnid')  is null begin alter table taraf add bid smallint null exec('update taraf set bid=0 where bid is null') end
if columnproperty(object_id('vorod'),'bid','columnid')  is null begin alter table vorod add bid smallint null exec('update vorod set bid=0 where bid is null') end
if columnproperty(object_id('[check]'),'bid','columnid')  is null begin alter table [check] add bid smallint null exec('update [check] set bid=0 where bid is null') end
if columnproperty(object_id('conf'),'weburl','columnid')  is null alter table conf add weburl nvarchar(30) null
if columnproperty(object_id('conf'),'branchstr','columnid')  is null alter table conf add branchstr nvarchar(400) null
if columnproperty(object_id('conf'),'branchconf','columnid')  is null alter table conf add branchconf nvarchar(200) null
if object_id('branchup') is null create table branchup (sqlind int identity not null primary key ,act smallint null  ,tbname nvarchar(20),flname nvarchar(20) null  ,flvalue bigint null ,branchstr nvarchar(400) null)
if columnproperty(object_id('[check]'),'hesshom1','columnid')  is null begin alter table [check] add hesshom1 nvarchar(30) null exec('update [check] set hesshom1=ltrim(str(hesshom,20,0))')  end
if columnproperty(object_id('[barg]'),'hesshom1','columnid')  is null begin alter table [barg] add hesshom1 nvarchar(30) null exec('update [barg] set hesshom1=ltrim(str(hesshom,20,0))')  end
if columnproperty(object_id('[resid2]'),'hesshom1','columnid')  is null begin alter table [resid2] add hesshom1 nvarchar(30) null exec('update [resid2] set hesshom1=ltrim(str(hesshom,20,0))')  end
if object_id('onlinesh1') is null create table onlinesh1 (sqlind int identity not null primary key ,dum1 smallint null  ,dum2 nvarchar(30) null  ,sh ntext null)
if columnproperty(object_id('[serial1]'),'gindex1','columnid')  is null begin alter table [serial1] add gindex1 bigint null exec('update [serial1] set gindex1=0')  end
if columnproperty(object_id('[profile]'),'khpr2','columnid')  is null begin alter table [profile] add khpr2 smallint null exec('update [profile] set khpr2=0')  end
if columnproperty(object_id('[special1]'),'censqlind','columnid')  is null begin alter table [special1] add censqlind bigint null exec('update [special1] set censqlind=0')  end
if columnproperty(object_id('[profile]'),'censqlind','columnid')  is null begin alter table [profile] add censqlind bigint null exec('update [profile] set censqlind=0')  end
if columnproperty(object_id('[conf]'),'censqlind','columnid')  is null begin alter table [conf] add censqlind bigint null exec('update [conf] set censqlind=0')  end
if columnproperty(object_id('[anbar]'),'censqlind','columnid')  is null begin alter table [anbar] add censqlind bigint null exec('update [anbar] set censqlind=0')  end
if columnproperty(object_id('[bankn]'),'censqlind','columnid')  is null begin alter table [bankn] add censqlind bigint null exec('update [bankn] set censqlind=0')  end
if columnproperty(object_id('[kala1]'),'censqlind','columnid')  is null begin alter table [kala1] add censqlind bigint null exec('update [kala1] set censqlind=0')  end
if columnproperty(object_id('profile'),'rozgabl','columnid')  is null alter table profile add rozgabl smallint null
if object_id('branches') is null create table branches(sqlind int identity not null primary key ,anbcode smallint null  ,seri smallint null ,start nvarchar(10) null,sh nvarchar(50) null)
if columnproperty(object_id('[shahr]'),'censqlind','columnid')  is null begin alter table [shahr] add censqlind bigint null exec('update [shahr] set censqlind=0')  end
if columnproperty(object_id('[tasvor]'),'censqlind','columnid')  is null begin alter table [tasvor] add censqlind bigint null exec('update [tasvor] set censqlind=0')  end
if columnproperty(object_id('[khfil]'),'censqlind','columnid')  is null begin alter table [khfil] add censqlind bigint null exec('update [khfil] set censqlind=0')  end
if columnproperty(object_id('[vrfil]'),'censqlind','columnid')  is null begin alter table [vrfil] add censqlind bigint null exec('update [vrfil] set censqlind=0')  end
alter table KHMISC alter column saat nvarchar(30)
if object_id('mes') is null create table mes(sqlind int identity not null primary key,sqlind1 int null,tarikh nvarchar(10) null,subject nvarchar(100) null,sh ntext null,attr nvarchar(255) null,seen bit null)
if columnproperty(object_id('[barg]'),'sh1','columnid')  is null alter table [barg] add sh1 nvarchar(255) null 
update [barg] set sh1='' where sh1 is null
if columnproperty(object_id('[profile]'),'bool1','columnid')  is null begin alter table [profile] add bool1 bit null exec('update [profile] set bool1=0')  end
if columnproperty(object_id('[profile]'),'bool2','columnid')  is null begin alter table [profile] add bool2 bit null exec('update [profile] set bool2=0')  end
if columnproperty(object_id('[profile]'),'bool3','columnid')  is null begin alter table [profile] add bool3 bit null exec('update [profile] set bool3=0')  end
if columnproperty(object_id('[profile]'),'sig','columnid')  is null begin alter table [profile] add sig int null exec('update [profile] set sig=0')  end
if columnproperty(object_id('[profile]'),'sigcol','columnid')  is null alter table [profile] add sigcol nvarchar(100) null 
update [profile] set sigcol=0 where sigcol is null
if columnproperty(object_id('[roznameh]'),'sig','columnid')  is null alter table [roznameh] add sig nvarchar(100) null
update [roznameh] set sig=0 where sig is null
if columnproperty(object_id('[vorod]'),'sig','columnid')  is null alter table [vorod] add sig nvarchar(100) null
update [vorod] set sig=0 where sig is null
if columnproperty(object_id('[khoroj]'),'sig','columnid')  is null alter table [khoroj] add sig nvarchar(100) null
update [khoroj] set sig=0 where sig is null
if columnproperty(object_id('[crm]'),'rozcode','columnid')  is null begin alter table [crm] add rozcode int null exec('update [crm] set rozcode=0')  end
update [khoroj] set sig='' where sig='0'
update [roznameh] set sig='' where sig='0'
update [profile] set sigcol='' where sigcol='0'
update [vorod] set sig='' where sig='0'
if columnproperty(object_id('[project]'),'censqlind','columnid')  is null begin alter table [project] add censqlind bigint null exec('update [project] set censqlind=0')  end
alter table conf alter column smsdomain nvarchar(50)
if columnproperty(object_id('tarafs'),'nodechecked','columnid')  is null alter table tarafs add nodechecked integer null
if columnproperty(object_id('rozshom'),'typ','columnid')  is null alter table rozshom add typ bit null
if columnproperty(object_id('[check]'),'meli','columnid')  is null alter table [check] add meli nvarchar(14) null
if columnproperty(object_id('barg'),'meli','columnid')  is null alter table barg add meli nvarchar(14) null
if columnproperty(object_id('[kala1]'),'typ','columnid')  is null begin alter table [kala1] add typ smallint null exec('update [kala1] set typ=0')  end
if columnproperty(object_id('khoroj'),'vas','columnid')  is null alter table khoroj add vas nvarchar(30) null
if columnproperty(object_id('[anbar1]'),'censqlind','columnid')  is null begin alter table [anbar1] add censqlind bigint null exec('update [anbar1] set censqlind=0')  end
if columnproperty(object_id('[kala]'),'zarib2','columnid')  is null begin alter table [kala] add zarib2 float null exec('update [kala] set zarib2=0')  end
if columnproperty(object_id('taraf'),'birth','columnid')  is null alter table taraf add birth nvarchar(10) null
if columnproperty(object_id('[havaleh]'),'seri','columnid')  is null begin alter table [havaleh] add seri smallint null exec('update [havaleh] set seri=0')  end
if columnproperty(object_id('[havalehr]'),'seri','columnid')  is null begin alter table [havalehr] add seri smallint null exec('update [havalehr] set seri=0')  end
if columnproperty(object_id('[branches]'),'scode','columnid')  is null begin alter table [branches] add scode int null exec('update [branches] set scode=0')  end
if columnproperty(object_id('[branches]'),'mcode','columnid')  is null begin alter table [branches] add mcode int null exec('update [branches] set mcode=0')  end
if columnproperty(object_id('profile'),'mob','columnid')  is null alter table profile add mob nvarchar(15) null
if columnproperty(object_id('vorodr'),'nodechecked','columnid')  is null begin alter table [vorodr] add nodechecked smallint null exec('update [vorodr] set nodechecked=0')  end
if columnproperty(object_id('khorojr'),'nodechecked','columnid')  is null begin alter table [khorojr] add nodechecked smallint null exec('update [khorojr] set nodechecked=0')  end
if columnproperty(object_id('havalehr'),'nodechecked','columnid')  is null begin alter table [havalehr] add nodechecked smallint null exec('update [havalehr] set nodechecked=0')  end
if columnproperty(object_id('tolidr'),'nodechecked','columnid')  is null begin alter table [tolidr] add nodechecked smallint null exec('update [tolidr] set nodechecked=0')  end
if columnproperty(object_id('havaleh'),'nodechecked','columnid')  is null begin alter table [havaleh] add nodechecked smallint null exec('update [havaleh] set nodechecked=0')  end
if columnproperty(object_id('[havaleh]'),'sig','columnid')  is null alter table [havaleh] add sig nvarchar(100) null
update [havaleh] set sig='' where sig is null
if columnproperty(object_id('gtcode'),'pormasraf','columnid')  is null alter table gtcode add pormasraf nvarchar(5) null
if columnproperty(object_id('conf'),'andname','columnid')  is null alter table conf add andname nvarchar(30) null
if columnproperty(object_id('khoroj'),'dum1','columnid')  is null begin alter table [khoroj] add dum1 smallint null exec('update [khoroj] set dum1=0')  end
if columnproperty(object_id('havaleh'),'fshom2','columnid')  is null begin alter table [havaleh] add fshom2 float null exec('update [havaleh] set fshom2=0')  end
if columnproperty(object_id('profile'),'dum1','columnid')  is null begin alter table [profile] add dum1 float null exec('update [profile] set dum1=0')  end
alter table [profile] alter column name nvarchar(35)
alter table [profile] alter column job nvarchar(25)
if columnproperty(object_id('special1'),'dum1','columnid')  is null begin alter table [special1] add dum1 float null exec('update [special1] set dum1=0')  end
if columnproperty(object_id('special1'),'dum2','columnid')  is null begin alter table [special1] add dum2 float null exec('update [special1] set dum2=0')  end
alter table [checkn] alter column sh nvarchar(10)
if columnproperty(object_id('tashim1'),'sal','columnid') is null alter table tashim1 add sal smallint null
if columnproperty(object_id('tashim1'),'mah','columnid') is null alter table tashim1 add mah smallint null
if columnproperty(object_id('tashim1'),'roz','columnid') is null alter table tashim1 add roz smallint null
if columnproperty(object_id('tashim1'),'ghr1','columnid') is null alter table tashim1 add ghr1 int null
if columnproperty(object_id('tashim1'),'ghr2','columnid') is null alter table tashim1 add ghr2 int null
if columnproperty(object_id('[havaleh]'),'censqlind','columnid')  is null begin alter table [havaleh] add censqlind bigint null exec('update [havaleh] set censqlind=0')  end
alter table [conf] alter column branchstr ntext
alter table [branchup] alter column branchstr ntext
if columnproperty(object_id('[branches]'),'act','columnid')  is null begin alter table [branches] add act int null exec('update [branches] set act=1')  end
if columnproperty(object_id('[branchup]'),'tarikh','columnid')  is null begin alter table [branchup] add tarikh int null exec('update [branchup] set tarikh=0')  end
if columnproperty(object_id('[branches]'),'lastlog','columnid')  is null begin alter table [branches] add lastlog int null exec('update [branches] set lastlog=0')  end
if columnproperty(object_id('[anbar1]'),'bidmoj','columnid')  is null begin alter table [anbar1] add bidmoj float null exec('update [anbar1] set bidmoj=0')  end
if columnproperty(object_id('[anbar1]'),'bidmoj2','columnid')  is null begin alter table [anbar1] add bidmoj2 float null exec('update [anbar1] set bidmoj2=0')  end
update taraf set ostan='' where ostan is null
update taraf set shahrestan='' where shahrestan is null
update taraf set codeposti='' where codeposti is null
update taraf set shahr='' where shahr is null
update taraf set meli='' where meli is null
if columnproperty(object_id('vrfil'),'ftype10','columnid')  is null alter table vrfil add ftype10 bit null
if columnproperty(object_id('khfil'),'ftype10','columnid')  is null alter table khfil add ftype10 bit null
if columnproperty(object_id('profile'),'mahfil1','columnid')  is null alter table profile add mahfil1 nvarchar(255) null
if columnproperty(object_id('kala'),'bool1','columnid') is null begin alter table kala add bool1 bit null exec('update kala set bool1=0')  end
if columnproperty(object_id('tahvil'),'ted2','columnid') is null alter table tahvil add ted2 float null
alter table tahvil alter column ted float null
if columnproperty(object_id('branches'),'deb','columnid') is null alter table branches add deb bit null
alter table calender alter column sh nvarchar(1000) null
if columnproperty(object_id('khfil'),'sigyes','columnid') is null alter table khfil add sigyes int null
if columnproperty(object_id('vrfil'),'sigyes','columnid') is null alter table vrfil add sigyes int null
if object_id('kala11') is null create table kala11(sqlind int identity not null primary key,roz1 smallint null,mah1 smallint null,sal1 smallint null,roz2 smallint null,mah2 smallint null,sal2 smallint null,tarikh1 int null,tarikh2 int null,sh nvarchar(50) null,gkcode float null,gh float null,kcode int null)
if object_id('kala12') is null create table kala12(sqlind int identity not null primary key ,fcode int null,kcode int null)
if columnproperty(object_id('conf'),'lockpass','columnid') is null alter table conf add lockpass varbinary(128) null
if columnproperty(object_id('conf'),'newcollock','columnid') is null alter table conf add newcollock nvarchar(10) null
if columnproperty(object_id('bijak'),'typ','columnid') is null alter table bijak add typ bit null
alter table sharh alter column sh nvarchar(300) null
if columnproperty(object_id('onlinesh1'),'tarikh','columnid') is null alter table onlinesh1 add tarikh int null
if columnproperty(object_id('branches'),'andver','columnid') is null alter table branches add andver nvarchar(10) null
if columnproperty(object_id('branches'),'appver','columnid') is null alter table branches add appver nvarchar(10) null
if columnproperty(object_id('branches'),'pass','columnid') is null alter table branches add pass nvarchar(20) null
if columnproperty(object_id('branches'),'devname','columnid') is null alter table branches add devname nvarchar(100) null
alter table bijak alter column barshom nvarchar(20) null
if columnproperty(object_id('profile'),'location','columnid') is null alter table profile add location nvarchar(1000) null
if object_id('conf1') is null create table conf1(sqlind int identity not null primary key ,lic nvarchar(4000) null,webup bit null,webup1 bit null)
update conf set censqlind=sqlind where censqlind=0
update anbar set censqlind=sqlind where censqlind=0
update bankn set censqlind=sqlind where censqlind=0
update project set censqlind=sqlind where censqlind=0
if columnproperty(object_id('ticket'),'webup','columnid') is null alter table ticket add webup bit null
if columnproperty(object_id('ticket'),'node','columnid') is null alter table ticket add node float null
if columnproperty(object_id('ticket'),'fname','columnid') is null alter table ticket add fname nvarchar(255) null
if object_id('t21696') is null CREATE TABLE t21696(sqlind int identity not null primary key,code int null,arikh int null,sms int null,saat int null,typ int null)
if object_id('jav')is null CREATE TABLE jav(sqlind int identity not null primary key,code int null ,tarikh1 int null ,Sal1 smallint null ,Mah1 smallint null ,Roz1 smallint null ,vazn1 float null ,tcode int null ,kcode int null ,kvazn float null ,kted float null ,kted2 float null ,kgh1 float null ,kojrat1 float null ,ghkol1 float null ,fanb smallint null ,tarikh2 int not null ,Sal2 smallint null ,Mah2 smallint null ,Roz2 smallint null ,vazn2 float null ,kgh2 float null ,kojrat2 float null ,ghkol2 float null ,kasry float null ,darsad float null ,ghkol float null)
if columnproperty(object_id('jav'),'kvazn2','columnid') is null alter table jav add kvazn2 float null
if columnproperty(object_id('jav'),'tlcode','columnid') is null alter table jav add tlcode float null
if object_id('javpre') is null CREATE TABLE javpre(sqlind int identity not null primary key,tcode int null,kcode int null,kname nvarchar(50) null,gh1 float null,gh2 float null)
if object_id('smsproto') is null CREATE TABLE smsproto(sqlind int identity not null primary key,code smallint null,sh nvarchar(500) null,scode nvarchar(50))
if columnproperty(object_id('smsproto'),'proto','columnid') is null alter table smsproto add proto nvarchar(500) null
if columnproperty(object_id('sms'),'scode','columnid') is null alter table sms add scode nvarchar(50) null
if columnproperty(object_id('onlinesh1'),'saat','columnid') is null alter table onlinesh1 add saat nvarchar(5) null
if columnproperty(object_id('conf'),'intg24','columnid')  is null alter table conf add intg24 smallint null
if columnproperty(object_id('khorsh'),'defsh','columnid')  is null alter table khorsh add defsh nvarchar(255) null
if columnproperty(object_id('[gtcode]'),'censqlind','columnid')  is null begin alter table [gtcode] add censqlind bigint null exec('update [gtcode] set censqlind=0')  end
if columnproperty(object_id('conf'),'woourl','columnid') is null alter table conf add woourl nvarchar(100) null
if columnproperty(object_id('conf'),'woosec','columnid') is null alter table conf add woosec nvarchar(50) null
if columnproperty(object_id('conf'),'wookey','columnid') is null alter table conf add wookey nvarchar(50) null
if columnproperty(object_id('special1'),'adr','columnid')  is null alter table special1 add adr nvarchar(250) null
if columnproperty(object_id('kala'),'wcode','columnid')  is null alter table kala add wcode nvarchar(50) null
if columnproperty(object_id('conf'),'woobhes','columnid') is null alter table conf add woobhes int null
if columnproperty(object_id('taraf'),'wcode','columnid')  is null alter table taraf add wcode nvarchar(50) null
alter table [smsproto] alter column sh nvarchar(1000)
alter table [smsproto] alter column proto nvarchar(1000)
if columnproperty(object_id('khoroj'),'prvbid','columnid')  is null alter table khoroj add prvbid smallint null
if columnproperty(object_id('khoroj'),'andsvtime','columnid')  is null alter table khoroj add andsvtime nvarchar(20) null
if columnproperty(object_id('khoroj'),'andsdtime','columnid')  is null alter table khoroj add andsdtime nvarchar(20) null
if columnproperty(object_id('conf'),'woourl2','columnid') is null alter table conf add woourl2 nvarchar(100) null
if columnproperty(object_id('conf'),'woosec2','columnid') is null alter table conf add woosec2 nvarchar(50) null
if columnproperty(object_id('conf'),'wookey2','columnid') is null alter table conf add wookey2 nvarchar(50) null
if columnproperty(object_id('kala'),'wcode2','columnid')  is null alter table kala add wcode2 nvarchar(50) null
if columnproperty(object_id('roznameh'),'tozcode','columnid')  is null alter table roznameh add tozcode int null
if object_id('niaz') is null CREATE TABLE niaz(sqlind int identity not null primary key,tarikh int null,tcode int null,tname nvarchar(30) null,kcode int null,kname nvarchar(50) null,ted float null,ted2 float null,sh nvarchar(50) null,node float null,ted2_1 float null,ted1_1 float null,tarikh1 int null)
alter table [dafkhor] alter column typ float
alter table [dafvor] alter column typ float
if columnproperty(object_id('kala'),'mal1','columnid') is null begin alter table kala add mal1 float null alter table kala add mal2 float null end
update kala set mal1=(select top(1) mal1 from conf) where mal1 is null
update kala set mal2=(select top(1) mal2 from conf) where mal2 is null
if columnproperty(object_id('kala'),'rozphort','columnid')  is null alter table kala add rozphort float null
if columnproperty(object_id('vorodrr'),'tam3','columnid')  is null alter table vorodrr add tam3 int null
if columnproperty(object_id('vorodrr'),'tar','columnid')  is null alter table vorodrr add tar nvarchar(50) null
if columnproperty(object_id('vorodrr'),'nodechecked','columnid')  is null alter table vorodrr add nodechecked integer null
if object_id('netvorr') is null create table netvorr(sqlind int identity not null primary key ,fcode int null  ,node float null)
if columnproperty(object_id('tarafs'),'bid','columnid')  is null begin alter table tarafs add bid smallint null exec('update tarafs set bid=0 where bid is null') end
alter table [check] alter column meli nvarchar(20)
alter table [barg] alter column meli nvarchar(20)
alter table [taraf] alter column meli nvarchar(20)
if columnproperty(object_id('specialrep'),'bid','columnid') is null begin alter table specialrep add bid int null exec('update specialrep set bid=0 where bid is null') end
if columnproperty(object_id('roznameh'),'dc','columnid')  is null alter table roznameh add dc int null
if columnproperty(object_id('bijak'),'sefup1','columnid')  is null alter table bijak add sefup1 bit null
if columnproperty(object_id('khfil'),'bid1','columnid') is null alter table khfil add bid1 int null
if columnproperty(object_id('khfil'),'bid2','columnid') is null alter table khfil add bid2 int null
if columnproperty(object_id('vrfil'),'bid1','columnid') is null alter table vrfil add bid1 int null
if columnproperty(object_id('vrfil'),'bid2','columnid') is null alter table vrfil add bid2 int null
if columnproperty(object_id('vrfil'),'bidch','columnid') is null alter table vrfil add bidch bit null
if columnproperty(object_id('khfil'),'bidch','columnid') is null alter table khfil add bidch bit null
if columnproperty(object_id('kala'),'dumbit1','columnid')  is null alter table kala add dumbit1 bit null
if columnproperty(object_id('profile'),'userfil','columnid')  is null alter table profile add userfil nvarchar(255) null
if columnproperty(object_id('roznameh'),'sefstr','columnid')  is null alter table roznameh add sefstr nvarchar(10) null
if columnproperty(object_id('havaleh'),'sefstr','columnid')  is null alter table havaleh add sefstr nvarchar(10) null
if columnproperty(object_id('vorod'),'sefstr','columnid')  is null alter table vorod add sefstr nvarchar(10) null
if columnproperty(object_id('taraf'),'wcode2','columnid')  is null alter table taraf add wcode2 nvarchar(50) null
if columnproperty(object_id('conf'),'woobhes2','columnid') is null alter table conf add woobhes2 int null
alter table conf alter column smsuser nvarchar(50)
if columnproperty(object_id('khortoz'),'sh1','columnid')  is null alter table khortoz add sh1 nvarchar(50) null
if columnproperty(object_id('special1'),'name3','columnid')  is null alter table special1 add name3 nvarchar(30) null
if columnproperty(object_id('special1'),'name4','columnid')  is null alter table special1 add name4 nvarchar(30) null
if columnproperty(object_id('special1'),'name5','columnid')  is null alter table special1 add name5 nvarchar(30) null
if columnproperty(object_id('special1'),'name6','columnid')  is null alter table special1 add name6 nvarchar(30) null
if columnproperty(object_id('conf'),'wooanb1','columnid') is null alter table conf add wooanb1 int null 
if columnproperty(object_id('conf'),'wooanb2','columnid') is null alter table conf add wooanb2 int null
if columnproperty(object_id('tahvil'),'node','columnid') is null alter table tahvil add node int null
if columnproperty(object_id('tahvil'),'saat','columnid') is null alter table tahvil add saat nvarchar(20) null
if columnproperty(object_id('tahvil'),'radif','columnid') is null alter table tahvil add radif int null
if columnproperty(object_id('tahvil'),'anbcode','columnid') is null alter table tahvil add anbcode int null
if object_id('wooupg') is null create table wooupg (sqlind int identity not null primary key,kcode int null,saat nvarchar(25))
if columnproperty(object_id('profile'),'branchfil','columnid')  is null alter table profile add branchfil nvarchar(255) null
if columnproperty(object_id('roznameh'),'centerok','columnid')  is null alter table roznameh add centerok bit null
if columnproperty(object_id('vorod'),'centerok','columnid')  is null alter table vorod add centerok bit null
if columnproperty(object_id('khoroj'),'centerok','columnid')  is null alter table khoroj add centerok bit null
if columnproperty(object_id('havaleh'),'centerok','columnid')  is null alter table havaleh add centerok bit null
if columnproperty(object_id('kala'),'lep1','columnid')  is null alter table kala add lep1 nvarchar(10) null
if columnproperty(object_id('branches'),'anbfilter','columnid')  is null alter table branches add anbfilter nvarchar(100) null
if columnproperty(object_id('kala'),'lepnode','columnid')  is null alter table kala add lepnode int null
if columnproperty(object_id('dafvor'),'mob','columnid')  is null alter table dafvor add mob bigint null
if columnproperty(object_id('dafkhor'),'mob','columnid')  is null alter table dafkhor add mob bigint null
if columnproperty(object_id('[taraftel]'),'censqlind','columnid')  is null begin alter table [taraftel] add censqlind bigint null exec('update [taraftel] set censqlind=0')  end
alter table dafkhor alter column mob nvarchar(50)
alter table dafvor alter column mob nvarchar(50)
alter table bijak alter column hamel nvarchar(100)
if columnproperty(object_id('[taraf]'),'smsch','columnid')  is null begin alter table [taraf] add smsch bit null exec('update [taraf] set smsch=0')  end
if columnproperty(object_id('kala'),'crdate','columnid')  is null alter table kala add crdate nvarchar(10) null
if columnproperty(object_id('[kala9]'),'sef','columnid')  is null begin alter table [kala9] add sef float null exec('update [kala9] set sef=0')  end
if columnproperty(object_id('[kala9]'),'typ','columnid')  is null begin alter table [kala9] add typ smallint null exec('update [kala9] set typ=0')  end
if columnproperty(object_id('[daftel]'),'card','columnid')  is null begin alter table [daftel] add card nvarchar(16) null exec('update [daftel] set card=0')  end
if columnproperty(object_id('vrfil'),'ttype9','columnid')  is null alter table vrfil add ttype9 bit null
if columnproperty(object_id('khfil'),'ttype9','columnid')  is null alter table khfil add ttype9 bit null
if columnproperty(object_id('khfil'),'facrsh','columnid')  is null alter table khfil add facrsh nvarchar(50) null
if columnproperty(object_id('khfil'),'facrshch','columnid')  is null alter table khfil add facrshch bit null
if columnproperty(object_id('khfil'),'rozsh','columnid')  is null alter table khfil add rozsh nvarchar(50) null
if columnproperty(object_id('khfil'),'rozshch','columnid')  is null alter table khfil add rozshch bit null
if columnproperty(object_id('vrfil'),'facrsh','columnid')  is null alter table vrfil add facrsh nvarchar(50) null
if columnproperty(object_id('vrfil'),'facrshch','columnid')  is null alter table vrfil add facrshch bit null
if columnproperty(object_id('vrfil'),'rozsh','columnid')  is null alter table vrfil add rozsh nvarchar(50) null
if columnproperty(object_id('vrfil'),'rozshch','columnid')  is null alter table vrfil add rozshch bit null
if columnproperty(object_id('kala'),'yekta','columnid')  is null alter table kala add yekta nvarchar(13) null
if columnproperty(object_id('khoroj'),'taxid','columnid')  is null alter table khoroj add taxid nvarchar(22) null
alter table special1 alter column name5 nvarchar(50)
alter table special1 alter column name6 nvarchar(50)
if columnproperty(object_id('conf'),'fiscalid','columnid')  is null alter table conf add fiscalid nvarchar(10) null
if object_id('vahed') is null create table vahed (sqlind int identity not null primary key ,name nvarchar(25) null ,code int null)
if columnproperty(object_id('kala'),'vahedcode','columnid')  is null alter table kala add vahedcode int null
alter table tarafs alter column vassh nvarchar(5)
if columnproperty(object_id('special1'),'name7','columnid')  is null alter table special1 add name7 nvarchar(30) null
if columnproperty(object_id('special1'),'name8','columnid')  is null alter table special1 add name8 nvarchar(30) null
if columnproperty(object_id('special1'),'name9','columnid')  is null alter table special1 add name9 nvarchar(30) null
if columnproperty(object_id('special1'),'name10','columnid')  is null alter table special1 add name10 nvarchar(30) null
if object_id('darlog') is null create table darlog(sqlind int identity not null primary key,fcode bigint null,uid nvarchar(36) null ,ptype nvarchar(20) null,retry bit null,data ntext null,iv nvarchar(100) null,datasign ntext null,taxid nvarchar(22) null,typ nvarchar(50) null)
if columnproperty(object_id('darlog'),'fshom','columnid')  is null alter table darlog add fshom float null
if columnproperty(object_id('vorod'),'taxid','columnid')  is null alter table vorod add taxid nvarchar(22) null
if columnproperty(object_id('vorod'),'taxidok','columnid')  is null alter table vorod add taxidok bit null
if columnproperty(object_id('khoroj'),'taxidok','columnid')  is null alter table khoroj add taxidok bit null
if columnproperty(object_id('tashim2'),'fcode','columnid')  is null alter table tashim2 add fcode int null
if columnproperty(object_id('picture'),'t1','columnid')  is null alter table picture add t1 int null
if columnproperty(object_id('picture'),'t2','columnid')  is null alter table picture add t2 int null
if columnproperty(object_id('vrfil'),'ftype11','columnid')  is null alter table vrfil add ftype11 bit null
if columnproperty(object_id('khfil'),'ftype11','columnid')  is null alter table khfil add ftype11 bit null
if columnproperty(object_id('conf'),'rondtarikh','columnid')  is null alter table conf add rondtarikh nvarchar(10) null
if columnproperty(object_id('conf'),'rond','columnid')  is null alter table conf add rond bit null
if columnproperty(object_id('conf'),'enname','columnid')  is null alter table conf add enname nvarchar(100) null
alter table [check] alter column Shobeh nvarchar(30)
alter table barg alter column Shobeh nvarchar(30)
if columnproperty(object_id('conf'),'pempath','columnid')  is null alter table conf add pempath nvarchar(100) null
if columnproperty(object_id('conf'),'intg25','columnid')  is null alter table conf add intg25 int null
if columnproperty(object_id('khoroj'),'scode','columnid')  is null alter table khoroj add scode int null
if columnproperty(object_id('vorod'),'scode','columnid')  is null alter table vorod add scode int null
if columnproperty(object_id('daftel'),'ftarikh','columnid')  is null alter table daftel add ftarikh nvarchar(10) null
if columnproperty(object_id('daftel'),'fshom','columnid')  is null alter table daftel add fshom float null
if columnproperty(object_id('daftel'),'ftasvieh','columnid')  is null alter table daftel add ftasvieh float null
if columnproperty(object_id('havaleh'),'kol','columnid')  is null alter table havaleh add kol float null
if columnproperty(object_id('gtcode'),'tcode1','columnid')  is null alter table gtcode add tcode1 int null
if columnproperty(object_id('gtcode'),'tcode2','columnid')  is null alter table gtcode add tcode2 int null
if columnproperty(object_id('gtcode'),'tcode3','columnid')  is null alter table gtcode add tcode3 int null
if columnproperty(object_id('profile'),'tghr','columnid')  is null alter table profile add tghr nvarchar(250) null
if columnproperty(object_id('bijak'),'gircodeposti','columnid')  is null alter table bijak add gircodeposti nvarchar(15) null
if columnproperty(object_id('special1'),'memo','columnid') is null alter table special1 add memo ntext null
if columnproperty(object_id('darlog'),'reftaxid','columnid')  is null alter table darlog add reftaxid nvarchar(22) null
if object_id('limoupg') is null create table limoupg (sqlind int identity not null primary key,kcode int null,saat nvarchar(25))
if columnproperty(object_id('limoupg'),'tcode','columnid')  is null alter table limoupg add tcode int null
if object_id('caller') is null create table caller (sqlind int identity not null primary key,number nvarchar(20) null,tname nvarchar(30) null)
if columnproperty(object_id('caller'),'line','columnid')  is null alter table caller add line int null
if columnproperty(object_id('caller'),'tarikh','columnid')  is null alter table caller add tarikh nvarchar(25) null 
if columnproperty(object_id('caller'),'node','columnid')  is null alter table caller add node int  null 
if columnproperty(object_id('taraf'),'rasbed','columnid')  is null alter table taraf add rasbed nvarchar(10) null
if columnproperty(object_id('tarafs'),'rasbed','columnid')  is null alter table tarafs add rasbed nvarchar(10) null
if columnproperty(object_id('kala'),'woostart','columnid')  is null alter table kala add woostart nvarchar(10) null
if columnproperty(object_id('kala'),'wooroz','columnid')  is null alter table kala add wooroz int null
if columnproperty(object_id('fartype'),'woostart','columnid')  is null alter table fartype add woostart nvarchar(10) null
if columnproperty(object_id('fartype'),'wooroz','columnid')  is null alter table fartype add wooroz int null
alter table ebarat alter column sh nvarchar(300)
if columnproperty(object_id('taraf'),'bbc','columnid')  is null alter table taraf add bbc int null
if columnproperty(object_id('conf'),'sbc','columnid')  is null alter table conf add sbc int null
if columnproperty(object_id('kala'),'woostart2','columnid')  is null alter table kala add woostart2 nvarchar(10) null
if columnproperty(object_id('kala'),'wooroz2','columnid')  is null alter table kala add wooroz2 int null
if columnproperty(object_id('kala'),'ghr1','columnid')  is null alter table kala add ghr1 int null
if columnproperty(object_id('kala'),'ghr2','columnid')  is null alter table kala add ghr2 int null
if columnproperty(object_id('sharh'),'node','columnid')  is null alter table sharh add node float null
if object_id('karmozd') is null create table karmozd(sqlind int identity not null primary key,tarikh nvarchar(10) null,typ1 nvarchar(20) null,typ2 nvarchar(20),mab float null,min float null,max float null)
if columnproperty(object_id('profile'),'card','columnid')  is null alter table profile add card nvarchar(16) null
if columnproperty(object_id('taraf'),'iban','columnid')  is null alter table taraf add iban nvarchar(24) null
if columnproperty(object_id('profile'),'kghr','columnid')  is null alter table profile add kghr nvarchar(250) null
if columnproperty(object_id('kala'),'tagcode','columnid')  is null alter table kala add tagcode int null
if columnproperty(object_id('roznameh'),'karmozd','columnid')  is null alter table roznameh add karmozd int null
if columnproperty(object_id('conf'),'smsapikey','columnid')  is null alter table conf add smsapikey nvarchar(200) null
if object_id('kalavision') is null create table kalavision(sqlind int identity not null primary key,kcode int null,rowcol nvarchar(4) null,gtcode int null)
if columnproperty(object_id('darlog'),'serial','columnid')  is null alter table darlog add serial bigint null
if columnproperty(object_id('taraf'),'mardate','columnid')  is null alter table taraf add mardate nvarchar(10) null
if columnproperty(object_id('taraf'),'zandate','columnid')  is null alter table taraf add zandate nvarchar(10) null
if columnproperty(object_id('taraf'),'cardtype','columnid')  is null alter table taraf add cardtype smallint null
if columnproperty(object_id('kala'),'sendmarkaz','columnid')  is null alter table kala add sendmarkaz bit null
alter table khoroj alter column vas nvarchar(50)
if columnproperty(object_id('stabdilazadr'),'ted1_2','columnid')  is null alter table stabdilazadr add ted1_2 float null
if columnproperty(object_id('stabdilazadr'),'ted2_2','columnid')  is null alter table stabdilazadr add ted2_2 float null
if columnproperty(object_id('conf'),'smsnewpass','columnid')  is null alter table conf add smsnewpass nvarchar(50) null
if columnproperty(object_id('profile'),'proj','columnid')  is null alter table profile add proj smallint null
if columnproperty(object_id('kala'),'print1','columnid')  is null alter table kala add print1 nvarchar(100) null
if columnproperty(object_id('kala9'),'kcode','columnid')  is null alter table kala9 add kcode int null
if columnproperty(object_id('check'),'sayadok','columnid')  is null begin alter table [check] add sayadok smallint null exec('update [check] set sayadok=0 where sayadok is null') end
if columnproperty(object_id('conf'),'snappay','columnid')  is null alter table conf add snappay nvarchar(512) null
alter table roznameh alter column tozcode float
alter table gtcode alter column name1 nvarchar(50)
if object_id('profile1') is null create table profile1(sqlind int identity not null primary key ,code int null  ,fil nvarchar(1000) null)
if columnproperty(object_id('taraf'),'toz4','columnid')  is null alter table taraf add toz4 int null
if columnproperty(object_id('taraf'),'toz5','columnid')  is null alter table taraf add toz5 int null
if columnproperty(object_id('khfil'),'tozch4','columnid')  is null alter table khfil add tozch4 bit null
if columnproperty(object_id('khfil'),'tozch5','columnid')  is null alter table khfil add tozch5 bit null
if columnproperty(object_id('vrfil'),'tozch4','columnid')  is null alter table vrfil add tozch4 bit null
if columnproperty(object_id('vrfil'),'tozch5','columnid')  is null alter table vrfil add tozch5 bit null
if columnproperty(object_id('khfil'),'toz4','columnid')  is null alter table khfil add toz4 int null
if columnproperty(object_id('khfil'),'toz5','columnid')  is null alter table khfil add toz5 int null
if columnproperty(object_id('vrfil'),'toz4','columnid')  is null alter table vrfil add toz4 int null
if columnproperty(object_id('vrfil'),'toz5','columnid')  is null alter table vrfil add toz5 int null
if columnproperty(object_id('khoroj'),'tozcode4','columnid')  is null alter table khoroj add tozcode4 int null
if columnproperty(object_id('khoroj'),'tozcode5','columnid')  is null alter table khoroj add tozcode5 int null
if columnproperty(object_id('vorod'),'tozcode4','columnid')  is null alter table vorod add tozcode4 int null
if columnproperty(object_id('vorod'),'tozcode5','columnid')  is null alter table vorod add tozcode5 int null
if columnproperty(object_id('kala'),'takh41','columnid')  is null alter table kala add takh41 float null
if columnproperty(object_id('kala'),'takh42','columnid')  is null alter table kala add takh42 float null
if columnproperty(object_id('kala'),'takh51','columnid')  is null alter table kala add takh51 float null
if columnproperty(object_id('kala'),'takh52','columnid')  is null alter table kala add takh52 float null
if columnproperty(object_id('taraf'),'bcode','columnid')  is null alter table taraf add bcode smallint null
if columnproperty(object_id('kala'),'dumsh','columnid')  is null alter table kala add dumsh nvarchar(100) null
if columnproperty(object_id('profile'),'phortype','columnid')  is null alter table profile add phortype nvarchar(50) null
if columnproperty(object_id('anbar2'),'loc','columnid')  is null alter table anbar2 add loc nvarchar(10) null
if columnproperty(object_id('conf'),'whatsapp1','columnid')  is null alter table conf add whatsapp1 nvarchar(100) null
if columnproperty(object_id('conf'),'whatsapp2','columnid')  is null alter table conf add whatsapp2 nvarchar(100) null
if columnproperty(object_id('sms'),'tarikh4','columnid') is null alter table sms add tarikh4 nvarchar(25) null
if columnproperty(object_id('sms'),'flink','columnid') is null alter table sms add flink nvarchar(100) null
if columnproperty(object_id('conf'),'intg26','columnid')  is null alter table conf add intg26 int null
if columnproperty(object_id('conf'),'whatsapp3','columnid')  is null alter table conf add whatsapp3 nvarchar(100) null
if object_id('onlinesh2') is null create table onlinesh2(sqlind int identity not null primary key ,tarikh nvarchar(20) null,node smallint null,repno smallint null,filter ntext null,fname nvarchar(100) null,crtarikh nvarchar(20) null,devname nvarchar(100) null)
if columnproperty(object_id('onlinesh2'),'repun','columnid')  is null alter table onlinesh2 add repun nvarchar(100) null
alter table kala alter column loc nvarchar(60)
if columnproperty(object_id('packing'),'nodechecked','columnid')  is null alter table packing add nodechecked integer null
if object_id('conf2') is null create table conf2(sqlind int identity not null primary key ,node int null,subject nvarchar(20) null,typ nvarchar(20) null,sh nvarchar(2000) null)


