use @DBNAMEYEAR
begin tran createMissionHour
if not exists (SELECT name 	  FROM 	 sysobjects 	  WHERE  name = N'MissionHour' 	  AND 	 type = 'U')
begin 
CREATE TABLE [MissionHour] (
	[PAGENO] [numeric](6, 0) NOT NULL ,
	[PERNO] [char] (@pernoLenght) COLLATE Arabic_CI_AS NOT NULL ,
	[BEGINDATE] [char] (5) COLLATE Arabic_CI_AS NOT NULL ,
	[BEGINTIME] [char] (5) COLLATE Arabic_CI_AS NULL ,
	[ENDDATE] [char] (5) COLLATE Arabic_CI_AS NULL ,
	[ENDTIME] [char] (5) COLLATE Arabic_CI_AS NULL ,
	[RowId] [numeric](6, 0) IDENTITY (1, 1) NOT NULL 
) ON [PRIMARY]

end

if @@ERROR > 0 
  rollback tran createMissionHour
commit 
