USE [@DBNAME]

if not exists (SELECT name 	  FROM 	 sysobjects 	  WHERE  name = N'Pattern' 	  AND 	 type = 'U')
begin 
begin tran createPattern
CREATE TABLE [dbo].[Pattern](
	[PatternId] [int] IDENTITY(1,1) NOT NULL PRIMARY KEY,
	[PatternName] [nvarchar](500) COLLATE Arabic_CI_AS  NULL,
	[PatternPermission] [char](100) COLLATE Arabic_CI_AS NULL,
) ON [PRIMARY]


if @@ERROR > 0 
  rollback tran createPattern
commit 

end
 


 