안녕하세요.
mssql 에서 data 업데이트 할게 많은데 10000건 한꺼번에 하니까 에러가 나서
200건씩 update 하고 commit 하고 하려고 하는데 일일이 문장에 commit 넣어주려니 힘들어서 그러는데 for 문이 쉬인 방법이 없을까요?
begin tran
UPDATE PCA020T SET WK_SHOP_TYPE = '5' WHERE org_cd = '01' and WK_ORD_NO ='MK1002334' AND ROUT_SEQ = '030'
UPDATE PCA020T SET WK_SHOP_TYPE = '5' WHERE org_cd = '01' and WK_ORD_NO ='MK1002335' AND ROUT_SEQ = '030'
commit
begin tran
UPDATE PCA020T SET WK_SHOP_TYPE = '5' WHERE org_cd = '01' and WK_ORD_NO ='MK1002336' AND ROUT_SEQ = '030'
UPDATE PCA020T SET WK_SHOP_TYPE = '5' WHERE org_cd = '01' and WK_ORD_NO ='MK1002338' AND ROUT_SEQ = '030'
UPDATE PCA020T SET WK_SHOP_TYPE = '5' WHERE org_cd = '01' and WK_ORD_NO ='MK1002334' AND ROUT_SEQ = '030'
UPDATE PCA020T SET WK_SHOP_TYPE = '5' WHERE org_cd = '01' and WK_ORD_NO ='MK1002335' AND ROUT_SEQ = '030'
commit
begin tran
UPDATE PCA020T SET WK_SHOP_TYPE = '5' WHERE org_cd = '01' and WK_ORD_NO ='MK1002336' AND ROUT_SEQ = '030'
UPDATE PCA020T SET WK_SHOP_TYPE = '5' WHERE org_cd = '01' and WK_ORD_NO ='MK1002338' AND ROUT_SEQ = '030'
commit
MS-SQL 도 BULK INSERT가 있는데 의미가 틀려.. SQL LOADER 같아.
https://docs.microsoft.com/ko-kr/sql/t-sql/statements/bulk-insert-transact-sql?view=sql-server-2017