You can use TEXTMERGE to build a query. It makes code more readable. Something like
TEXT TO lcSQL TEXTMERGE NOSHOW PRETEXT 7
insert into table (field1, field2, field3, .....)
values (...)
ENDTEXT
lcSQL = CHRTRAN(lcSQL, CHR(13)+CHR(10),"")
=sqlexec(..., lcSQL, ...)
The SPT parameters is another option you should explore.
>
>for the first time i am using VFP to insert and update data in a SQL 2000 server. i typically have very long lines that look like this
>
>=sqlprepare(...insert into table (field1, field2, field3, .....) values (...)
>=sqlexec(...)
>
>my problem is that the first statement is often more than 254 characters, (its often 500 or 700 characters) so i get a VFP error. what i end up doing is breaking up the insert into an insert and one or more updates. it is a major pain in the arse and a waste of time. i do something like this
>
>=sqlprepare(...insert into table
>=sqlexec(...)
>
>=sqlprepare(...select max(id) from table...)
>=sqlexec(...)
>
>=sqlprepare(...update table set .... where id=maxid
>=sqlexec(...)
>
>i know i must be doing something wrong and am overlooking a simple solution.
>
--sb--