DECLARE @PR棜楌No int
DECLARE @彜昳No int
DECLARE @屭媞No int
DECLARE @搊榐僗僞僢僼No int
DECLARE @峀崘No int
DECLARE @僾儘儌乕僔儑儞梊掕No int
DECLARE @僾儘儌乕僔儑儞幚愌No int
DECLARE @PR嬫暘No int
DECLARE @憤旓梡 int
DECLARE @懳徾彜昳憤悢 int
DECLARE @懳徾婛懚屭媞憤悢 int
DECLARE @桳岠擔悢撪偺憤攧忋 int
DECLARE @怴婯屭媞妉摼悢 int
DECLARE @尒崬屭媞妉摼悢 int
DECLARE @孈婲偟屭媞悢 int
DECLARE @峏怴僗僞僢僼No int
DECLARE @PR柤 varchar
DECLARE @撪梕 varchar
DECLARE @旛峫 varchar
DECLARE @岞奐梊掕擔 datetime
DECLARE @岞奐幚巤擔 datetime
DECLARE @梊掕婜娫fr datetime
DECLARE @梊掕婜娫to datetime
DECLARE @岞奐梊掕擔fr datetime
DECLARE @岞奐梊掕擔to datetime
DECLARE @岞奐幚巤擔fr datetime
DECLARE @岞奐幚巤擔to datetime
DECLARE @幚巤婜娫fr datetime
DECLARE @幚巤婜娫to datetime
DECLARE @媥柊懳徾擔 datetime
DECLARE @斕攧擔帪fr datetime
DECLARE @斕攧擔帪to datetime

SET @PR棜楌No = 1
SET @彜昳No = 1
SET @屭媞No = 1
SET @搊榐僗僞僢僼No = 1
SET @峀崘No = 1
SET @僾儘儌乕僔儑儞梊掕No = 1
SET @僾儘儌乕僔儑儞幚愌No = 1
SET @PR嬫暘No = 1
SET @憤旓梡 = 1
SET @懳徾彜昳憤悢 = 1
SET @懳徾婛懚屭媞憤悢 = 1
SET @桳岠擔悢撪偺憤攧忋 = 1
SET @怴婯屭媞妉摼悢 = 1
SET @尒崬屭媞妉摼悢 = 1
SET @孈婲偟屭媞悢 = 1
SET @峏怴僗僞僢僼No = 1
SET @PR柤 = 'a'
SET @撪梕 = 'a'
SET @旛峫 = 'a'
SET @岞奐梊掕擔 = '2002/1/11'
SET @岞奐幚巤擔 = '2002/1/11'
SET @幚巤婜娫fr = '2002/1/11'
SET @幚巤婜娫to = '2003/7/11'
SET @媥柊懳徾擔 = '2001/7/15'
SET @梊掕婜娫fr = '2001/7/15'
SET @梊掕婜娫to = '2001/7/15'
SET @岞奐梊掕擔fr = '2002/1/11'
SET @岞奐梊掕擔to = '2002/1/11'
SET @岞奐幚巤擔fr = '2002/1/11'
SET @岞奐幚巤擔to = '2002/1/11'
SET @斕攧擔帪fr = '2002/1/11'
SET @斕攧擔帪to = '2002/1/11'



---- Fill
--SELECT
--	 H08僾儘儌乕僔儑儞梊掕_懳徾峀崘.慻怐No
--	,H08僾儘儌乕僔儑儞梊掕_懳徾峀崘.PR棜楌No
--	,H08僾儘儌乕僔儑儞梊掕_懳徾峀崘.峀崘No
--	,M10峀崘.峀崘柤
--	,M10峀崘.扴摉幰柤
--	,M10峀崘.TEL
--	,M10峀崘.FAX
--	,M10峀崘.儊乕儖傾僪儗僗
--	,M10峀崘.URL
--FROM
--	H08僾儘儌乕僔儑儞梊掕_懳徾峀崘 LEFT OUTER JOIN
--	M10峀崘 ON H08僾儘儌乕僔儑儞梊掕_懳徾峀崘.峀崘No = M10峀崘.峀崘No
--WHERE
--	H08僾儘儌乕僔儑儞梊掕_懳徾峀崘.慻怐No = @慻怐No AND
--	H08僾儘儌乕僔儑儞梊掕_懳徾峀崘.PR棜楌No = @PR棜楌No
SELECT
	H08僾儘儌乕僔儑儞梊掕_懳徾峀崘.僾儘儌乕僔儑儞梊掕_懳徾峀崘No, 
	H08僾儘儌乕僔儑儞梊掕_懳徾峀崘.PR棜楌No, 
	H08僾儘儌乕僔儑儞梊掕_懳徾峀崘.峀崘No,
	M10峀崘.峀崘柤, 
	M10峀崘.扴摉幰柤,
	M10峀崘.TEL,
	M10峀崘.FAX,
	M10峀崘.儊乕儖傾僪儗僗, 
	M10峀崘.URL
FROM
	H08僾儘儌乕僔儑儞梊掕_懳徾峀崘 LEFT OUTER JOIN
	M10峀崘 ON H08僾儘儌乕僔儑儞梊掕_懳徾峀崘.峀崘No = M10峀崘.峀崘No
WHERE
	H08僾儘儌乕僔儑儞梊掕_懳徾峀崘.PR棜楌No = @PR棜楌No


---- DeleteByPR棜楌No
--DELETE FROM
--	H08僾儘儌乕僔儑儞梊掕_懳徾峀崘
--WHERE
--	慻怐No = @慻怐No AND
--	PR棜楌No = @PR棜楌No
DELETE FROM
	H08僾儘儌乕僔儑儞梊掕_懳徾峀崘
WHERE
	PR棜楌No = @PR棜楌No


---- InsertCommand
--INSERT INTO H08僾儘儌乕僔儑儞梊掕_懳徾峀崘
--(
--	 慻怐No
--	,PR棜楌No
--	,峀崘No
--	,搊榐儐乕僓乕No
--	,搊榐擔帪
--	,峏怴儐乕僓乕No
--	,峏怴擔帪
--)VALUES(
--	 @慻怐No
--	,@PR棜楌No
--	,@峀崘No
--	,@搊榐儐乕僓乕No
--	,getdate()
--	,@搊榐儐乕僓乕No
--	,getdate()
--)
INSERT INTO H12僾儘儌乕僔儑儞幚愌_懳徾峀崘
(
	 PR棜楌No
	,峀崘No
	,搊榐僗僞僢僼No
	,搊榐擔帪
	,峏怴僗僞僢僼No
	,峏怴擔帪
)VALUES(
	 @PR棜楌No
	,@峀崘No
	,@搊榐僗僞僢僼No
	,getdate()
	,@搊榐僗僞僢僼No
	,getdate()
)


