Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IIF syntax
Message
From
15/09/2015 14:57:45
 
 
To
15/09/2015 14:38:15
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01624559
Message ID:
01624639
Views:
65
>>>Hi Karen
>>>
>>>First things first - design. The point of databases is not to do things Row By Agonizing Row, but to think in terms of sets. It is very rare to write a replace command to affect one record. If you are doing that, to me, it suggests this is happening inside a larger loop. 1 replace commands such as this
>>
>>Design?
>>If one like to change multiple records there is SQL UPDATE. Why learning outdated syntax? Is there realy a sense in NEXT xx or WHILE xx? The data should not depend on order .... (Except you are dealing with VFP sources like vcx,scx frx ....)
>>
>>The good on REPLACE is that it can be used on a single record without any change of record pointer and superfluous expression. Here it has a great advantage to SQL UPDATE. So I would do what the OP seems to do (altering a field on a condition) on some pre-save checks on record level using REPLACE.
>
>REPLACE has another benefit
>
>REPLACE ;
>field1 with value1, ;
>field2 with value2
>
>is better than
>
>UPDATE (field1, field2) values (value1, value2)
>
>With long commands, having each field near the update value is a benefit.

You're confused with INSERT - SQL syntax.

The syntax of UPDATE - SQL is:
UPDATE MyTable SET ;
  Column1 = Expression1 ;
  , Column2 = Expression2 ;
  ...
Having an = between each column and corresponding expression is closer and clearer than WITH.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform