I managed to get what I needed. This is what my code looks like:
dim sqlstring
dim err
sqlstring = "insert into atpa...."
Set rsATPA = CreateObject("ADODB.REcordSet")
On Error Resume Next
set rsATPA = Conn.Execute(SQLstring)
retcode=0
on error goto 0
If conn.Errors.count <> 0 Then
retcode...
Ok, I've searched the web with Google, and I've read over 100 Q&As on this forum, but I can't find anywhere how to get the SQL return code out of a recordset after an insert.
I am doing inserts of records that come from an outside vendor, and they often send records with duplicate keys.
I want...
Marc, I was expecting the 'F' to be set only where there was a matching fail record on the ATPA table, and left with the already set ' ' when there was no fail record. My problem was that I had to compare both stulink AND testlink for each record, which messed me up when I used IN (select...)...
Change this bit:
WHERE AIM.AIMRetrievedItem.ArchiveRetrievalID = (SELECT
AIM.AIMRETRIEVEDITEM.ARCHIVERETRIEVALID
FROM
to WHERE AIM.AIMRetrievedItem.ArchiveRetrievalID IN (SELECT
AIM.AIMRETRIEVEDITEM.ARCHIVERETRIEVALID
FROM
I'm getting closer.
This code UPDATE APRF3951 SET (passfail, testdate) = (Select Distinct 'F', max(ATPA3951.admdate) From ATPA3951 Where APRF3951.stulink = ATPA3951.stulink AND APRF3951.testlink = ATPA3951.partnum AND ATPA3951.testlink in (61, 62, 63) And (ATPA3951.scoreone like '%N%' or...
The INNER JOIN clause is something I've never used before. I was taught to join my tables in the WHERE clause but all the stuff I found searching the web said I needed an inner join.
My original update looked like this:
update aprf3951 a set (a.passfail, a.testdate) = (select 'F', b.admdate from...
I need to update 1 table from another table. Simple enough, but I can't get it to work.
Here are my tables and the important fields:
APRF
stulink
testlink
passfail
testdate
ATPA
stulink
testlink (not the same as APRF.testlink)
partnum (IS the same as APRF.testlink)
scoreone
admdate
There is no...
I managed to get it to work. It was a wierdo. Apparently I needed to have a join both inside my subselect and outside the subselect. Without that, I was doing a non "correlated update".
My SQL wound up looking like:
update astu3201 set engprof =
(select epscode from eps_codes...
I need to update a DB2 table with values from a temporary table, populated from a file.
The ASTU is my student record table, the EPS_CODES is my temp table. ASTU contains about 100 fields, the only one of which I need to update is named ENGPROF. The PK is PERMNUM.
EPS_CODES has 3 fields...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.