Numeric Data in SQL insert

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

Numeric Data in SQL insert

Post by Colin Haig »

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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Numeric Data in SQL insert

Post by Enrico Maria Giordano »

Colin,

here it is a sample:

Code: Select all

cSql = "INSERT INTO MyTable ( MyNumericField ) VALUES ( " + LTRIM( STR( nMyValue ) ) + " )"
EMG
Colin Haig
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am

Re: Numeric Data in SQL insert

Post by Colin Haig »

Hi Enrico

Thank you very much !!!!!

Cheers

Colin
Francisco Horta
Posts: 845
Joined: Sun Oct 09, 2005 5:36 pm
Location: la laguna, mexico.

Re: Numeric Data in SQL insert

Post by Francisco Horta »

colin

try

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

regards
paco
____________________
Paco
User avatar
Armando
Posts: 2479
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México
Contact:

Re: Numeric Data in SQL insert

Post by Armando »

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
Post Reply