INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Problem on DB2 Update SQL in VB.Net

Problem on DB2 Update SQL in VB.Net

(OP)
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)



RE: Problem on DB2 Update SQL in VB.Net


What is the problem, exactly? Are you getting any error messages?

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!

RE: Problem on DB2 Update SQL in VB.Net

(OP)
Actually there is no error on my sample code, it only replaces the Alpha_Code of ITEMTEST table with a blank.. I need to replace the Alpha_code field in ITEMTEST table with the right Alphacode in CSVTEST Table.

My exact problem, what is the complete set of SQL Update command to replace the Alpha_code of ITEMTEST table?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close