select DISTINCT COUNT(*) AS DIST_113 from DISTRICT
select DISTINCT COUNT(*) AS DIST_ICON from ICON_EntForms_District
select DISTINCT COUNT(*) AS SDIST_113 from SUBDISTRICT
select DISTINCT COUNT(*) AS SDIST_ICON from ICON_EntForms_SubDistrict
*/
--- COMPARE (DIST,SDIST) // DATA NOT EQUAL//
SELECT DISTINCT COUNT(*) AS TOTAL_113
FROM SUBDISTRICT SD INNER JOIN DISTRICT D
ON SD.SDIST_DIST_ID = D.DIST_ID
SELECT DISTINCT COUNT(*) AS TOTAL_ICON
FROM ICON_EntForms_SubDistrict ISD INNER JOIN ICON_EntForms_District ID
ON ISD.DistrictID=ID.DistrictID
---------------FUNCTION TO UPDATE POSTAL IN SUBDISTRICT ---------------------
DECLARE @SDIST_NAME NVARCHAR(255)
DECLARE @DIST_NAME NVARCHAR(255)
DECLARE @POSTAL NVARCHAR(10)
DECLARE @TOTAL INT
DECLARE @I INT
SET @I =0
SELECT DISTINCT @TOTAL = COUNT (*) FROM SUBDISTRICT SD INNER JOIN
DISTRICT D ON SD.SDIST_DIST_ID = D.DIST_ID
WHILE (@I<=@TOTAL)
BEGIN
SET @I+=1
--- INTITIAL DIST,SDIST
SELECT @SDIST_NAME = SDIST_NAME,@DIST_NAME =DIST_NAME
FROM SUBDISTRICT SD INNER JOIN DISTRICT D
ON SD.SDIST_DIST_ID = D.DIST_ID
WHERE SD.SDIST_ID = (@I+34296)
--- FIND POSTAL FOR EACH (DIST,SDIST)
SELECT @POSTAL=ISD.PostCode
FROM ICON_EntForms_SubDistrict ISD INNER JOIN ICON_EntForms_District ID
ON ISD.DistrictID=ID.DistrictID
WHERE ISD.SubDistrictName = @SDIST_NAME AND ID.DistrictName=@DIST_NAME
--- PRINT (UPDATE)
--PRINT(CONVERT(VARCHAR(10),@
UPDATE SUBDISTRICT SET SDIST_POSTAL =@POSTAL WHERE SDIST_ID = (@I+34296)
END
--PRINT(@TOTAL)
JAM Casino - The JTA Hub
ตอบลบjampirama casino hotel, casino, hotel, 밀양 출장샵 casino, hotel, Jampirama - The 군포 출장샵 JTA Hub. 전주 출장샵 Jampirama - The JTA Hub. Jampirama - The JTA Hub. 대전광역 출장마사지 Jampirama - The JTA Hub. 영주 출장마사지 Jampirama - The J