/**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_PERM_PSWSTRATEGY' AND KSQL_COL_NAME ='FHASCASELETTER') 
 ALTER TABLE T_PERM_PSWSTRATEGY ADD (FHASCASELETTER CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PERM_PSWSTRATEGY' AND KSQL_COL_NAME ='FWEAKPSW') 
 ALTER TABLE T_PERM_PSWSTRATEGY ADD (FWEAKPSW CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ORG_DUTY' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_ORG_DUTY ADD (FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ORG_BIZLIST' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_ORG_BIZLIST ADD (FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ORG_VIEWSCHEMA' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_ORG_VIEWSCHEMA ADD (FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ORG_PATTERN' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_ORG_PATTERN ADD (FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ORG_STRUCTURE' AND KSQL_COL_NAME ='FFULLNAME') 
 ALTER TABLE T_ORG_STRUCTURE ADD (FFULLNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ORG_ORG' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_ORG_ORG ADD (FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ORG_STRUCTURE_H' AND KSQL_COL_NAME ='FFULLNAME') 
 ALTER TABLE T_ORG_STRUCTURE_H ADD (FFULLNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ORG_ORG_H' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_ORG_ORG_H ADD (FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SEC_USERPOSITION_H' AND KSQL_COL_NAME ='FPOSITION')
 ALTER TABLE T_SEC_USERPOSITION_H ADD (FPOSITION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SEC_USERTYPE' AND KSQL_COL_NAME ='FNAME')
 ALTER TABLE T_SEC_USERTYPE ADD (FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SEC_USER' AND KSQL_COL_NAME ='FTRUENAME')
 ALTER TABLE T_SEC_USER ADD (FTRUENAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SEC_USER_H' AND KSQL_COL_NAME ='FTRUENAME')
 ALTER TABLE T_SEC_USER_H ADD (FTRUENAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SEC_USERPOSITION' AND KSQL_COL_NAME ='FPOSITION')
 ALTER TABLE T_SEC_USERPOSITION ADD (FPOSITION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ORG_TYPERELATION' AND KSQL_COL_NAME ='FNAME')
 ALTER TABLE T_ORG_TYPERELATION ADD (FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ORG_DUTYGROUP' AND KSQL_COL_NAME ='FNAME')
 ALTER TABLE T_ORG_DUTYGROUP ADD (FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SEC_BIZPARTNERUSER_C') 
 CREATE TABLE T_SEC_BIZPARTNERUSER_C (
FID BIGINT DEFAULT 0 NOT NULL,
FCUSTOMERINFOID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SEC_USER_D') 
 CREATE TABLE T_SEC_USER_D (
FID BIGINT DEFAULT 0 NOT NULL,
FDRPUSERTYPE CHAR(1) DEFAULT '1' NOT NULL,
FISSALEMANAGER CHAR(1) DEFAULT '0' NOT NULL
);



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