BEGIN TRANSACTION;
DELETE FROM DC2.dbo.MS_100 WHERE PV_USER = '300';
COMMIT TRANSACTION;

BEGIN TRANSACTION;
INSERT INTO 
DC2.dbo.MS_100 (PV_USER,PV1)
SELECT '300'
,COUNT(*)
FROM
DC2_DEMO.dbo.SAM_DENPYO T001
 LEFT OUTER JOIN DC2_DEMO.dbo.SAM_SYOHIN T002 ON
 T001.DEN_SYO_CD=T002.SYO_CD
WHERE
 T001.DEN_KB='2'
 AND T001.DEN_DATE BETWEEN '20100101' AND '20100103'
;
COMMIT TRANSACTION;


