FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Numeric Data in SQL insert
Posts: 310
Joined: Mon Oct 10, 2005 05:10 AM
Numeric Data in SQL insert
Posted: Thu May 16, 2013 09:35 AM
Hi All

I am interfacing my software with QuickBooks - in my SQL insert statements I do the following

do while cInvcNo == oInvItms:invcno .and. ! oInvItms:eof()
aadd(aInvItems,{cClient,cInvcNo,nQty,nAmount})
oInvItms:skip()
enddo

for I := 1 to len(aInvData)
cSql :=''
cSql+= "INSERT INTO InvoiceLine (ClientName,InvoiceNumber,LineQuantity,LineAmount) VALUES ('" + aInvItems[I,1] + "','" + aInvItems[I,2] + "', // how to insert numeric values



Cheers

Colin
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Numeric Data in SQL insert
Posted: Thu May 16, 2013 10:11 AM
Colin,

here it is a sample:

Code (fw): Select all Collapse
cSql = "INSERT INTO MyTable ( MyNumericField ) VALUES ( " + LTRIM( STR( nMyValue ) ) + " )"


EMG
Posts: 310
Joined: Mon Oct 10, 2005 05:10 AM
Re: Numeric Data in SQL insert
Posted: Thu May 16, 2013 10:39 AM

Hi Enrico

Thank you very much !!!!!

Cheers

Colin

Posts: 845
Joined: Sun Oct 09, 2005 05:36 PM
Re: Numeric Data in SQL insert
Posted: Thu May 16, 2013 05:08 PM

colin

try

INSERT INTO MyTable ( MyNumericField1,MyNumericField2 ) VALUES ( " + STR( nMyVal1 ) + "," + STR( nMyVal2 ) + " )"

regards
paco

____________________

Paco
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Numeric Data in SQL insert
Posted: Thu May 16, 2013 10:20 PM

Colin:

In SQL, everything is stored as string, example for Date fields you should use DTOS(YourDate).

Regards

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero

Continue the discussion