|
acid_bratt
Starting Member
13 Posts |
Posted - 2003-09-12 : 23:02:34
|
| Hi .. Is there a way I can optimize the code below so that it won't take me hours to have it done?-- insert data from text file to temporary tableBULK INSERT GLServerDB.dbo.GLwposteddetails FROM 'D:\GLS\SrcFiles\P0803EH.txt' WITH (FORMATFILE = 'C:\GLS\POSTED.fmt')-- delete trailer & header recordsDelete from GLwPostedDetailsWhere wp_AcctYear = ' '-- insert records from working table to true tableinsert INTO GLtPostedDetails (pd_CtrlEntity, pd_BKUnit, pd_BKDept, pd_GLCode, pd_ProdCode, pd_BaseCurr, pd_SourceCurr, pd_RecordType, pd_AcctYear, pd_AcctPeriod, pd_VersionNo, pd_EffectiveDate, pd_JEGrpNumber, pd_JEGrpDate, pd_JENumber, pd_JEAmount, pd_DCInd, pd_JECurrAmt, pd_TransDesc, pd_ExchRate, pd_ExchRTTypeCode, pd_ExchRTEffDate, pd_TransCode, pd_SLCode, pd_PresentingUnit, pd_PresentingDept, pd_AcctRuleID, pd_RefNo, pd_UserID, pd_SourceJESeq, pd_UpdateDate, pd_UpdateTime)SELECT wp_CtrlEntity, wp_BKUnit, wp_BKDept, wp_GLCode, wp_ProdCode, wp_BaseCurr, wp_SourceCurr, wp_RecordType, wp_AcctYear, wp_AcctPeriod, wp_VersionID, convert(smalldatetime, wp_EffectiveDate, 101) as wp_EffectiveDate, wp_JEGrpNumber, convert(smalldatetime, wp_JEGrpDate, 101) as wp_JEGrpDate, wp_JENumber, wp_JEAmount, wp_DCInd, cast(wp_JECurrAmt as decimal) as wp_JECurrAmt, wp_TransDesc, cast(wp_ExchRate as decimal) as wp_ExchRate, wp_ExchRTTypeCode, case when wp_ExchRTEffDate = ' ' then null else convert(smalldatetime, wp_ExchRTEffDate, 101) end as wp_ExchRTEffDate, wp_TransCode, wp_SLCode, wp_PresentingUnit, wp_PresentingDept, wp_AcctRuleID, wp_RefNo, wp_UserID, wp_SourceJESeq, convert(smalldatetime,wp_UpdateDate, 101) as wp_UpdateDate, convert(smalldatetime, wp_UpdateTime) as wp_UpdateTimeFROM GLwPostedDetailsdelete from glwposteddetailsnext file-- addl info: text files contains million records Thanks.. |
|