메뉴 건너뛰기

kode2.com

오라클 유니코드를 MSSQL 비유니코드 VARCHAR로 입력하는 법
1. 오라클 쿼리시 UTL_RAW.CAST_TO_RAW(컬럼명) 별칭
2. MSSQL 쿼리시 CAST( 별칭 AS VARCHAR) 컬럼명

예제)
INSERT INTO T_BASE_INFO ( PART_NO, OPART_NO, PART_NM, SPEC, APPMODEL_NO, PART_TP1, CD1_NM, CD2_NM, CD5_NM, CD6_NM, USRNM, KCUST_NM )

SELECT  A.PART_NO, A.OPART_NO, CAST(A.PART_NM as varchar) PART_NM, CAST(A.SPEC as varchar) SPEC, CAST( A.APPMODEL_NO as varchar) APPMODEL_NO, CAST( A.PART_TP1 as varchar) PART_TP1, CAST( A.CD1_NM as varchar) CD1_NM, CAST( A.CD2_NM as varchar) CD2_NM, CAST( A.CD5_NM as varchar) CD5_NM, CAST( A.CD6_NM as varchar) CD6_NM, CAST( A.USRNM as varchar) USRNM, CAST( A.KCUST_NM as varchar ) KCUST_NM
FROM OPENQUERY( STCW,
'SELECT
         R1.PART_NO,  R1.OPART_NO, UTL_RAW.CAST_TO_RAW(R1.PART_NM) PART_NM, UTL_RAW.CAST_TO_RAW(R1.SPEC) SPEC, UTL_RAW.CAST_TO_RAW(R1.APPMODEL_NO) APPMODEL_NO,
         UTL_RAW.CAST_TO_RAW(( SELECT CDNM FROM ABS_BOOKD WHERE KDCD = ''350'' AND R1.PART_TP1 = CDNO )) PART_TP1,
         UTL_RAW.CAST_TO_RAW(( SELECT CDNM FROM ABS_BOOKD WHERE KDCD = ''381'' AND R2.CLS_CD1 = CDNO )) CD1_NM,
         UTL_RAW.CAST_TO_RAW(( SELECT CDNM FROM ABS_BOOKD WHERE KDCD = ''382'' AND R2.CLS_CD2 = CDNO )) CD2_NM,
         UTL_RAW.CAST_TO_RAW(( SELECT CDNM FROM ABS_BOOKD WHERE KDCD = ''506'' AND R2.CLS_CD5 = CDNO )) CD5_NM,
         UTL_RAW.CAST_TO_RAW(( SELECT CDNM FROM ABS_BOOKD WHERE KDCD = ''386'' AND R2.CLS_CD6 = CDNO )) CD6_NM,
         UTL_RAW.CAST_TO_RAW((
               SELECT B.USRNM
                  FROM
                        ABS_STOCKPOL S,
                        JSS_USER     B

                  WHERE S.FACT_TP = ''010201''
                  AND S.PUR_EMP = B.USRID
                  AND S.PART_NO = R1.PART_NO
               )) USRNM,
         UTL_RAW.CAST_TO_RAW(( SELECT KCUST_NM FROM ABS_STOCKPOL A, ABS_CUSTOM B WHERE A.FACT_TP = ''010201'' AND R1.PART_NO = A.PART_NO AND A.BCUST_NO = B.CUST_NO )) KCUST_NM

FROM T_BA_PARTGROUP R2, ABS_PARTNO R1
WHERE R1.PART_NO = R2.PART_NO') A

 

출처 : http://xarfox.tistory.com/11