Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Conditionally updating fields
Message
From
14/10/2016 06:40:02
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
13/10/2016 10:25:14
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
MS SQL Server
Miscellaneous
Thread ID:
01641827
Message ID:
01641939
Views:
47
>>
>>cSQL = ''
>>for iField = 1 to ALines(aa, m.cField, 5)
>> cField = m.aa[m.iField]
>> cSQL = m.cSQL + Iif(IsNull(Evaluate('m.' + m.cField)), '', ',' + m.cField + '=?m.' + m.cField)
>>endfor
>>
>>result = Iif(empty(m.cSQL);
>> , .null.;
>> , executeQuery('UPDATE Employees SET ' + Ltrim(m.cSQL, ',') + ' WHERE emp_pk = ?m.emp_pk');
>> )
>
> Nicely done!

That's what I had in mind!

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform