主题:求教一个SQL语句问题
求教一个SQL语句问题
由于SQL语句过长,VB6解析不了,打算把SQL语句拆分开了执行,但是不知道怎么拆啊,打算用insert+update,不过不知道update这句该怎么写
原来的SQL语句:
Call openRs("insert into DLs(DLID) Select UFDATA_111_2008..DispatchLists.DLID,UFDATA_111_2008..DispatchLists.cInvCode,UFDATA_111_2008..DispatchLists.cInvName,UFDATA_111_2008..DispatchLists.iQuantity,UFDATA_111_2008..Warehouse.cWhName,UFDATA_111_2008..RdRecord.cCode,UFDATA_111_2008..Inventory.iInvWeight,UFDATA_111_2008..Inventory.iVolume from UFDATA_111_2008..DispatchLists Inner join UFDATA_111_2008..DispatchList on UFDATA_111_2008..DispatchList.DLID = UFDATA_111_2008..DispatchLists.DLID Left outer Join UFDATA_111_2008..Warehouse on UFDATA_111_2008..DispatchLists.cWhCode = UFDATA_111_2008..Warehouse.cWhCode Left outer join UFDATA_111_2008..Inventory on UFDATA_111_2008..DispatchLists.cInvCode = UFDATA_111_2008..Inventory.cInvCode Left outer join UFDATA_111_2008..RdRecord on (UFDATA_111_2008..RdRecord.cBusCode = UFDATA_111_2008..DispatchList.cDLCode and UFDATA_111_2008..RdRecord.cWhCode = UFDATA_111_2008..DispatchLists.cWhCode) where UFDATA_111_2008..DispatchList.DLID='" & iUDLID & "'")
拆分后的SQL语句(少写入了两个字段,打算用update补上这两个字段):
Call openRs("insert into DLs(DLID,cCHBM,cCHMC,fYFSL,cSCC,cDBDH) Select UFDATA_111_2008..DispatchLists.DLID,UFDATA_111_2008..DispatchLists.cInvCode,UFDATA_111_2008..DispatchLists.cInvName,UFDATA_111_2008..DispatchLists.iQuantity,UFDATA_111_2008..Warehouse.cWhName,UFDATA_111_2008..RdRecord.cCode from UFDATA_111_2008..DispatchLists Inner join UFDATA_111_2008..DispatchList on UFDATA_111_2008..DispatchList.DLID = UFDATA_111_2008..DispatchLists.DLID Left outer Join UFDATA_111_2008..Warehouse on UFDATA_111_2008..DispatchLists.cWhCode = UFDATA_111_2008..Warehouse.cWhCode Left outer join UFDATA_111_2008..Inventory on UFDATA_111_2008..DispatchLists.cInvCode = UFDATA_111_2008..Inventory.cInvCode Left outer join UFDATA_111_2008..RdRecord on (UFDATA_111_2008..RdRecord.cBusCode = UFDATA_111_2008..DispatchList.cDLCode and UFDATA_111_2008..RdRecord.cWhCode = UFDATA_111_2008..DispatchLists.cWhCode) where UFDATA_111_2008..DispatchList.DLID='" & iUDLID & "'")
然后就不知道该怎么办了
由于SQL语句过长,VB6解析不了,打算把SQL语句拆分开了执行,但是不知道怎么拆啊,打算用insert+update,不过不知道update这句该怎么写
原来的SQL语句:
Call openRs("insert into DLs(DLID) Select UFDATA_111_2008..DispatchLists.DLID,UFDATA_111_2008..DispatchLists.cInvCode,UFDATA_111_2008..DispatchLists.cInvName,UFDATA_111_2008..DispatchLists.iQuantity,UFDATA_111_2008..Warehouse.cWhName,UFDATA_111_2008..RdRecord.cCode,UFDATA_111_2008..Inventory.iInvWeight,UFDATA_111_2008..Inventory.iVolume from UFDATA_111_2008..DispatchLists Inner join UFDATA_111_2008..DispatchList on UFDATA_111_2008..DispatchList.DLID = UFDATA_111_2008..DispatchLists.DLID Left outer Join UFDATA_111_2008..Warehouse on UFDATA_111_2008..DispatchLists.cWhCode = UFDATA_111_2008..Warehouse.cWhCode Left outer join UFDATA_111_2008..Inventory on UFDATA_111_2008..DispatchLists.cInvCode = UFDATA_111_2008..Inventory.cInvCode Left outer join UFDATA_111_2008..RdRecord on (UFDATA_111_2008..RdRecord.cBusCode = UFDATA_111_2008..DispatchList.cDLCode and UFDATA_111_2008..RdRecord.cWhCode = UFDATA_111_2008..DispatchLists.cWhCode) where UFDATA_111_2008..DispatchList.DLID='" & iUDLID & "'")
拆分后的SQL语句(少写入了两个字段,打算用update补上这两个字段):
Call openRs("insert into DLs(DLID,cCHBM,cCHMC,fYFSL,cSCC,cDBDH) Select UFDATA_111_2008..DispatchLists.DLID,UFDATA_111_2008..DispatchLists.cInvCode,UFDATA_111_2008..DispatchLists.cInvName,UFDATA_111_2008..DispatchLists.iQuantity,UFDATA_111_2008..Warehouse.cWhName,UFDATA_111_2008..RdRecord.cCode from UFDATA_111_2008..DispatchLists Inner join UFDATA_111_2008..DispatchList on UFDATA_111_2008..DispatchList.DLID = UFDATA_111_2008..DispatchLists.DLID Left outer Join UFDATA_111_2008..Warehouse on UFDATA_111_2008..DispatchLists.cWhCode = UFDATA_111_2008..Warehouse.cWhCode Left outer join UFDATA_111_2008..Inventory on UFDATA_111_2008..DispatchLists.cInvCode = UFDATA_111_2008..Inventory.cInvCode Left outer join UFDATA_111_2008..RdRecord on (UFDATA_111_2008..RdRecord.cBusCode = UFDATA_111_2008..DispatchList.cDLCode and UFDATA_111_2008..RdRecord.cWhCode = UFDATA_111_2008..DispatchLists.cWhCode) where UFDATA_111_2008..DispatchList.DLID='" & iUDLID & "'")
然后就不知道该怎么办了