Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting into table on AS/400 using VB - SQL Statement 1

Status
Not open for further replies.

gillianm1

Programmer
Sep 8, 2000
26
IE
Hi,
I want to insert into a table on AS/400 using a sql statement embedded in Visual Basic. I am connecting to the database using ODBC.

Could someone please tell me if the following statement will work. I'm presuming that regular sql syntax is fine but can someone let me know if I'm wrong (do I need single quotes around my values?). I can't check myself yet because the AS/400 server is at a remote site.

Thanks in advance,
Gillian

INSERT INTO IMPOSBSTD
SELECT UCORNO,UCIVNO,UCIVDT,UCCUNO,UCORTP,UCWHLO,UCITNO,UCIVQT,UCIVQS,UCIVQA,UCRGDT,UCRGTM From OSBSTD
WHERE (((OSBSTD.UCRGDT)=19990101) AND ((OSBSTD.UCRGTM)>100000)) OR (((OSBSTD.UCRGDT)>19990101))
[sig][/sig]
 
A couple of questions...

Are the date fields signed, packed, or timestamp (I think that's what it's called in DB2). Also, if you are getting an error which states the table is not valid for operation, it needs to be journalled and have a unique key.


A few other things you can do (if you're using client access for your ODBC provider).

1. See if you can ping the server (assumming using TCP/IP)
2. See if you can ODBCPING the server.

Good Luck

Regards...Marc
Independent Software Consultant
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top