DELETE FROM VS4TProductSafeS where TPSSTBRaCode=(SELECT tbracode FROM vs4tbranch WHERE tbraTBRTALIAS = 'HEADOFFICE')
GO
INSERT INTO VS4TProductSafeS  (TPSSTPdtCode, TPSSTBRaCode,TPSSMainTLCtcode,TPSSPurTLCtcode,TPSSRepTLCtcode,TPSSBrkTLCtcode,TPSSSaleTLCtcode
,TPSSStockMin, TPssStockMax, TPSSReFill, TPSSSAfePErDay, TPSSSafeTotalDay, TPSSLeadDay)
       SELECT TPdtCode,(SELECT tbracode FROM vs4tbranch WHERE tbraTBRTALIAS = 'HEADOFFICE'),TPdtMainTLCtcode,TPdtPurTLCtcode,TPdtRepTLCtcode,TPdtBrkTLCtcode,TPdtSaleTLCtcode
,TPdtStockMin, TPdtStockMax, TPdtReFill, TPdtSAfePErDay, TPdtSafeTotalDay, TPdtLeadDay
       FROM VS4TProduct
GO
