SQL Insert into... Select...

SQL Insert into... Select...

Postby mtajkov » Thu Jul 14, 2022 9:06 am

Hi,

I try:

Code: Select all  Expand view

.
.
.
    oCn := FW_OpenAdoConnection( aCredentials, .t. )
.
.
.

cSql:="INSERT INTO Smp_Test (SELECT PR_Sifra, PR_Naziv FROM Smp_Partneri)"
oCn:Execute( cSql )
 


i am getting an error:

Error ADODB.Connection/0 S_OK: EXECUTE
Parameter :
[ 1] = C INSERT INTO Smp_Test (SELECT PR_Sifra, PR_Naziv FROM Smp_Partneri)

Please Help
Best regards
Milos

[ FWH 21.11 ] [ xHarbour 1.2.3 Intl. (SimpLex) (Build 20150603) ]
mtajkov
 
Posts: 130
Joined: Sun Mar 08, 2009 4:33 pm

Re: SQL Insert into... Select...

Postby cmsoft » Thu Jul 14, 2022 12:16 pm

Make sure that Smp_Test has only two fields of the same type as PR_Sifra and PR_Naziv


If the instead, has more fields that you don't want to fill, then put
Code: Select all  Expand view

cSql:="INSERT INTO Smp_Test (PR_Sifra,PR_Naziv) (SELECT PR_Sifra, PR_Naziv FROM Smp_Partneri)"
oCn:Execute( cSql )
 
User avatar
cmsoft
 
Posts: 1285
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: SQL Insert into... Select...

Postby mtajkov » Thu Jul 14, 2022 12:49 pm

Thank you
Best regards
Milos

[ FWH 21.11 ] [ xHarbour 1.2.3 Intl. (SimpLex) (Build 20150603) ]
mtajkov
 
Posts: 130
Joined: Sun Mar 08, 2009 4:33 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: SantaCroya and 55 guests