/**Begin  **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_MUTEXRECORD') 
 CREATE TABLE T_EB_MUTEXRECORD (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNUMBER NVARCHAR(100) DEFAULT ' ' NOT NULL,
FBILLTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOPTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATOR BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME
);
EXEC P_ALTERPK 'PK_T_EB_MUTEXRECORD', 'T_EB_MUTEXRECORD', 'FID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'INDEX_EB_MUTEXRECORD_1') CREATE UNIQUE INDEX INDEX_EB_MUTEXRECORD_1 ON T_EB_MUTEXRECORD ( FBILLTYPE ASC ,FBILLNUMBER ASC,FOPTYPE ASC );

/**End **/