1.) csvtest table
CREATE TABLE csvtest (intcode varCHAR(14), deptcode varchar(3), alphacode varchar(5))
sample record of csvtest :
intcode ----- deptcode ----- alphacode
12021907-------13----------- "DSP"
11992564-------14----------- "ALP"
11803570-------15----------- "TOS"
2.) itemtest table
CREATE TABLE itemTest (intcode CHAR(14), alpha_code varchar(3))
sample record of itemtest :
intcode-------------------- alpha_code
00001202190713 ------------ ASL
00001199256408 ------------ ALS
00001180357015 ------------ DSP
the composition of intcode 00001202190713 is
Code- skucode - deptcode
0000- 12021907 - 13
I want to replace all alpha_code of itemtest table with the alphacode of csvtest table.
skucode and deptcode should match with intcode and deptcode of csvtest table..
Here is my sample code. Can anyone help me please... thank you
Imports IBM.Data.DB2
Imports System.IO
Imports System.IO.File
Imports IBM.Data.DB2.DB2BulkCopy
Dim con As New DB2Connection(GlobalVariables.masterconnection)
Dim COM As String = "Update all itemTEST b set b.alpha_code = (select a.alphacode from csvtest a where substr(b.intcode,4,8)=a.intcode)"
Dim Adpt As New DB2DataAdapter(com, con)
CREATE TABLE csvtest (intcode varCHAR(14), deptcode varchar(3), alphacode varchar(5))
sample record of csvtest :
intcode ----- deptcode ----- alphacode
12021907-------13----------- "DSP"
11992564-------14----------- "ALP"
11803570-------15----------- "TOS"
2.) itemtest table
CREATE TABLE itemTest (intcode CHAR(14), alpha_code varchar(3))
sample record of itemtest :
intcode-------------------- alpha_code
00001202190713 ------------ ASL
00001199256408 ------------ ALS
00001180357015 ------------ DSP
the composition of intcode 00001202190713 is
Code- skucode - deptcode
0000- 12021907 - 13
I want to replace all alpha_code of itemtest table with the alphacode of csvtest table.
skucode and deptcode should match with intcode and deptcode of csvtest table..
Here is my sample code. Can anyone help me please... thank you
Imports IBM.Data.DB2
Imports System.IO
Imports System.IO.File
Imports IBM.Data.DB2.DB2BulkCopy
Dim con As New DB2Connection(GlobalVariables.masterconnection)
Dim COM As String = "Update all itemTEST b set b.alpha_code = (select a.alphacode from csvtest a where substr(b.intcode,4,8)=a.intcode)"
Dim Adpt As New DB2DataAdapter(com, con)