/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BOS_table.sql **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LIC_GROUP' AND KSQL_COL_NAME ='FPRODID') 
 ALTER TABLE T_LIC_GROUP ADD (FPRODID VARCHAR(36) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_LIC_LICENSEGROUPAPPS') 
 CREATE TABLE T_LIC_LICENSEGROUPAPPS (
FDETAILID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FBIZAPPID VARCHAR(36) DEFAULT ' ' NOT NULL
);

EXEC P_ALTERPK 'PK_T_LIC_LICENSEGROUPAPPS', 'T_LIC_LICENSEGROUPAPPS', 'FDETAILID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_LIC_LICENSEGROUPAPPS_ENTRY') CREATE INDEX IDX_LIC_LICENSEGROUPAPPS_ENTRY ON T_LIC_LICENSEGROUPAPPS ( FENTRYID );

/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BOS_table.sql **/
