/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BASE_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BD_MATCOSTINFO') 
 CREATE TABLE T_BD_MATCOSTINFO (
FID BIGINT DEFAULT 0 NOT NULL,
FSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FCOSTTYPEID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITTIME DATETIME,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FCONSIDERYIELDRATE CHAR(1) DEFAULT '0' NOT NULL,
FCONSIDERSUBMATERIALLOSS CHAR(1) DEFAULT '0' NOT NULL,
FCONSIDERPREPARETIME CHAR(1) DEFAULT '0' NOT NULL,
FCONSIDERVALIDPERIOD CHAR(1) DEFAULT '0' NOT NULL,
FAUXPTYID BIGINT DEFAULT 0 NOT NULL,
FMATVERSIONID BIGINT DEFAULT 0 NOT NULL,
FBOMTYPEID BIGINT DEFAULT 0 NOT NULL,
FBOMID BIGINT DEFAULT 0 NOT NULL,
FPROCESSROUTEID BIGINT DEFAULT 0 NOT NULL,
FEFFECTDATE DATETIME,
FEXPDATE DATETIME,
FSOURCE VARCHAR(30) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BD_MATCOSTINFO_L') 
 CREATE TABLE T_BD_MATCOSTINFO_L (
FPKID NVARCHAR(30) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(10) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BD_MATCOSTINFOENTRY') 
 CREATE TABLE T_BD_MATCOSTINFOENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSUBELEMENTID BIGINT DEFAULT 0 NOT NULL,
FELEMENTID BIGINT DEFAULT 0 NOT NULL,
FSTANDARDCOST DECIMAL(23,10) DEFAULT 0 NOT NULL
);


 EXEC p_AlterColumn 'T_BD_PROJECTKIND', 'FFULLNAME', 'NVARCHAR(255)', 'NOT NULL', '0001', ''' ''';

 EXEC p_AlterColumn 'T_BD_PROJECTKIND', 'FNAME', 'NVARCHAR(100)', 'NOT NULL', '0001', ''' ''';

 EXEC p_AlterColumn 'T_BD_PROJECTKIND', 'FDESCRIPTION', 'NVARCHAR(255)', 'NOT NULL', '0001', ''' ''';

 EXEC p_AlterColumn 'T_BD_PROJECT', 'FNAME', 'NVARCHAR(255)', 'NOT NULL', '0001', ''' ''';


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