Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need advice with long vfp commands over 254 characters
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP3
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
00981108
Message ID:
00981153
Views:
18
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--
Previous
Reply
Map
View

Click here to load this message in the networking platform