IF NOT EXISTS (select 1 from sysobjects where name = '(PREPARETABLENAME)')
BEGIN
CREATE TABLE [(PREPARETABLENAME)] (
  [id] int IDENTITY NOT NULL,
  [code20] char(20) not null,
  [codeSn] integer not null,
  [prodsubtype] char(10) not null,
  [resprodcode] varchar(13) not null,
  [codelv] tinyint not null,
  [fileid] integer not null,
  [status] tinyint not null default 0,
  [updatepc] varchar(10) NULL,
  [taskid]  integer,
  [vbatch] varchar(20),
  [firsttime] datetime default getdate() not null,
  [lasttime] datetime default getdate(),
  PRIMARY KEY NONCLUSTERED ([code20])
)
CREATE CLUSTERED INDEX [IX_(PREPARETABLENAME)_FILEID] ON [dbo].[(PREPARETABLENAME)](
  [fileid] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]

CREATE NONCLUSTERED INDEX [IX_(PREPARETABLENAME)_1] ON [(PREPARETABLENAME)]
(
  [resprodcode] ASC

)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]

END
