Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Samir H.
  Where is Samir H.?
 Yogyakarta
 Indonesia
 Samir H.
 To: sri kishan
  Where is sri kishan?
 
 India
 sri kishan
 Tags
Subject: RE: how we can update record with one sql
Thread ID: 310834 Message ID: 310838 # Views: 41 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: General VFP Topics
Date: Saturday, June 25, 2011 8:33:37 PM         
   


> we are using this kind of sql for update records
>
>
> update table1 set table1.filed1=table2.field1 where table1.pk=table2.pk
> 
> if _tally=0
>   insert into table1 (field1) select (field1) from table2 where ...
> endif
> 
> 

>
> how we can do this with one sql.
>
> Regards

I guess you cannot because UPDATE and INSERT do two different things. What you could do is a SELECT to check if there is such a record, then a IF-ELSE-ENDIF, with either a Update or a Insert.

Regards
Samir

ENTIRE THREAD

how we can update record with one sql Posted by sri kishan @ 6/25/2011 7:47:45 PM
RE: how we can update record with one sql Posted by Stefan Wuebbe @ 6/25/2011 8:27:20 PM
RE: how we can update record with one sql Posted by sri kishan @ 6/25/2011 8:50:01 PM
RE: how we can update record with one sql Posted by Samir H. @ 6/25/2011 8:33:37 PM
RE: how we can update record with one sql Posted by sri kishan @ 6/26/2011 8:11:20 AM
RE: how we can update record with one sql Posted by Samir H. @ 6/26/2011 10:49:14 AM
RE: how we can update record with one sql Posted by Anders Altberg @ 6/25/2011 11:27:29 PM