Numeric Data in SQL insert

Numeric Data in SQL insert

Postby Colin Haig » Thu May 16, 2013 9: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
Colin Haig
 
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am

Re: Numeric Data in SQL insert

Postby Enrico Maria Giordano » Thu May 16, 2013 10:11 am

Colin,

here it is a sample:

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


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Numeric Data in SQL insert

Postby Colin Haig » Thu May 16, 2013 10:39 am

Hi Enrico

Thank you very much !!!!!

Cheers

Colin
Colin Haig
 
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am

Re: Numeric Data in SQL insert

Postby Francisco Horta » Thu May 16, 2013 5:08 pm

colin

try

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

regards
paco
____________________
Paco
Francisco Horta
 
Posts: 845
Joined: Sun Oct 09, 2005 5:36 pm
Location: la laguna, mexico.

Re: Numeric Data in SQL insert

Postby Armando » 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
User avatar
Armando
 
Posts: 3223
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 94 guests