if Exists(SELECT * FROM information_schema.tables where Table_name = 'Finance_Cycle') begin print 'true' end else begin create table Finance_Cycle ( ID int primary key, Code int not null, Title nvarchar(200), TarikhAz int not null, TarikhEla int not null, Serial int Not null , Is_Current bit not null Default 0, Is_Close bit not null default 0 ) end -- if not Exists (Select * from Finance_Cycle where ID = -1) begin insert into Finance_Cycle(ID, Code,Title,TarikhAz,TarikhEla,Serial) values(-1,0,'تعریف نشده',0,0,0) end if not Exists (Select * from Finance_Cycle where ID = 21) begin insert into Finance_Cycle(ID, Code,Title,TarikhAz,TarikhEla,Serial) values(21,1390,'سال مالی 1390',13900101,13901229,90) end if not Exists (Select * from Finance_Cycle where ID = 22) begin insert into Finance_Cycle(ID, Code,Title,TarikhAz,TarikhEla,Serial) values(22,1391,'سال مالی 1391',13910101,13911229,91) end if not Exists (Select * from Finance_Cycle where ID = 23) begin insert into Finance_Cycle(ID, Code,Title,TarikhAz,TarikhEla,Serial) values(23,1392,'سال مالی 1392',13920101,13921229,92) end if not Exists (Select * from Finance_Cycle where ID = 24) begin insert into Finance_Cycle(ID, Code,Title,TarikhAz,TarikhEla,Serial) values(24,1393,'سال مالی 1393',13930101,13931229,93) end if not Exists (Select * from Finance_Cycle where ID = 25) begin insert into Finance_Cycle(ID, Code,Title,TarikhAz,TarikhEla,Serial) values(25,1394,'سال مالی 1394',13940101,13941229,94) end --select * from Finance_Cycle