/**Begin D:\PDM_UPGRADE\PDM1\EB_constraint.sql **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_WHITELIST' AND KSQL_COL_NAME IN ('FNAMELISTTYPE')) 
 ALTER TABLE T_EB_WHITELIST ADD (FNAMELISTTYPE NVARCHAR(50) DEFAULT '2' NOT NULL);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_WHITEORGENTRY') 
CREATE TABLE T_EB_WHITEORGENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FORGBIZTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FORGBIZNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FORGBIZNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FORGBIZID BIGINT DEFAULT 0 NOT NULL
);

EXEC P_ALTERPK 'PK_EB_WHITEORGENTRY', 'T_EB_WHITEORGENTRY', 'FENTRYID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_WHITEORGENTRY') 
CREATE INDEX IDX_EB_WHITEORGENTRY ON T_EB_WHITEORGENTRY (FID);
 
/**End D:\PDM_UPGRADE\PDM1\EB_constraint.sql **/