/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\FA_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_ASSETDRAWBACK' AND KSQL_COL_NAME ='FREALASSETORGID') 
 ALTER TABLE T_FA_ASSETDRAWBACK ADD (FREALASSETORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_ASSETDRAWBACK' AND KSQL_COL_NAME ='FSOURCETYPE') 
 ALTER TABLE T_FA_ASSETDRAWBACK ADD (FSOURCETYPE NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_ASSET_REQUISITION' AND KSQL_COL_NAME ='FASSETORGID') 
 ALTER TABLE T_FA_ASSET_REQUISITION ADD (FASSETORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_ASSET_REQUISITION' AND KSQL_COL_NAME ='FSOURCETYPE') 
 ALTER TABLE T_FA_ASSET_REQUISITION ADD (FSOURCETYPE NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_ASSETTRANSFER' AND KSQL_COL_NAME ='FRECEIVEASSETORGID') 
 ALTER TABLE T_FA_ASSETTRANSFER ADD (FRECEIVEASSETORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_ASSETTRANSFER' AND KSQL_COL_NAME ='FSOURCETYPE') 
 ALTER TABLE T_FA_ASSETTRANSFER ADD (FSOURCETYPE NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_CHANGEBAK_FIN' AND KSQL_COL_NAME ='FBIZPERIODID') 
 ALTER TABLE T_FA_CHANGEBAK_FIN ADD (FBIZPERIODID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_CHANGEBAK_FIN' AND KSQL_COL_NAME ='FDEPREUSEID') 
 ALTER TABLE T_FA_CHANGEBAK_FIN ADD (FDEPREUSEID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_CHANGEBAK_FIN' AND KSQL_COL_NAME ='FISNEEDDEPRE') 
 ALTER TABLE T_FA_CHANGEBAK_FIN ADD (FISNEEDDEPRE CHAR(1) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_CHANGEBAK_FIN' AND KSQL_COL_NAME ='FMONTHDEPRE') 
 ALTER TABLE T_FA_CHANGEBAK_FIN ADD (FMONTHDEPRE DECIMAL(19,6) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_CHANGEBAK_FIN' AND KSQL_COL_NAME ='FMONTHORIGVALCHG') 
 ALTER TABLE T_FA_CHANGEBAK_FIN ADD (FMONTHORIGVALCHG DECIMAL(19,6) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_CHANGEBAK_FIN' AND KSQL_COL_NAME ='FMONTHDEPRECHG') 
 ALTER TABLE T_FA_CHANGEBAK_FIN ADD (FMONTHDEPRECHG DECIMAL(19,6) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_STOREKEEPER') 
 CREATE TABLE T_FA_STOREKEEPER (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL,
FSTATUS CHAR(1) DEFAULT 'C' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE CHAR(1) DEFAULT '0' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSTOREKEEPERID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_ASSET_APPLY' AND KSQL_COL_NAME ='FASSETORGID') 
 ALTER TABLE T_FA_ASSET_APPLY ADD (FASSETORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_STOREKEEPER_L') 
 CREATE TABLE T_FA_STOREKEEPER_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL
);



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