Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Anders Altberg
  Where is Anders Altberg?
 Uppsala
 Sweden
 Anders Altberg
 To: Dianne Benedicto
  Where is Dianne Benedicto?
 Davao City
 Philippines
 Dianne Benedicto
 Tags
Subject: RE: replacing fields using SQL statements?
Thread ID: 188802 Message ID: 188875 # Views: 1 # Ratings: 1
Version: Visual FoxPro 7 Category: Databases, Tables and SQL Server
Date: Tuesday, August 12, 2008 11:39:25 AM         
   


> Hi! Thanks for the help... That's another solution. I'll try to play those codes.. Thanks!

As I understood it, you didn't have any working solution at all so far. So it's not another solution, it's the solution :-)

-Anders

PS I see Christian had a solution in message 188802. It works but it will call UPDATE several hundred times perhaps so it would be very inefficient. But I guess this is a one-off job.
In Xbase this would be efficient
SELECT Student 
SET ORDER TO TAG studentid
SELECT Personal 
SCAN  
 IF SEEK(studentid, 'Student') 
 REPLACE firstname WITH Student.firstname, lastname WITH Student.lastname
 ENDIF 
ENDSCAN 


If Students is a very small table and Personal a very big table it would be most efficient to SCAN Students; like this:
SELECT Personal 
SET ORDER TO Studentid
SELECT Student
SCAN 
 IF SEEK(studentid, 'Personal')
  REPLACE Personal.firstname WITH Student.firstname, ;
  Personal.lastname WITH Student.lastname IN Personal
 ENDIF
ENDSCAN 

You asked for an SQL solution. There isn't a complete one in VFP7.
-Anders

ENTIRE THREAD

replacing fields using SQL statements? Posted by Dianne Benedicto @ 8/12/2008 7:32:01 AM
RE: replacing fields using SQL statements? Posted by Christian Tabligan @ 8/12/2008 7:51:41 AM
RE: replacing fields using SQL statements? Posted by Dianne Benedicto @ 8/12/2008 8:50:13 AM
RE: replacing fields using SQL statements? Posted by surinder singh @ 8/12/2008 8:58:04 AM
RE: replacing fields using SQL statements? Posted by Glenn Villar @ 8/12/2008 8:59:56 AM
RE: replacing fields using SQL statements? Posted by Dianne Benedicto @ 8/12/2008 9:13:52 AM
RE: replacing fields using SQL statements? Posted by Glenn Villar @ 8/12/2008 9:21:39 AM
RE: replacing fields using SQL statements? Posted by Dianne Benedicto @ 8/12/2008 9:26:53 AM
RE: replacing fields using SQL statements? Posted by Glenn Villar @ 8/12/2008 9:31:13 AM
RE: replacing fields using SQL statements? Posted by Dianne Benedicto @ 8/12/2008 9:42:44 AM
RE: replacing fields using SQL statements? Posted by Glenn Villar @ 8/12/2008 9:51:47 AM
RE: replacing fields using SQL statements? Posted by Christian Tabligan @ 8/12/2008 9:32:13 AM
RE: replacing fields using SQL statements? Posted by Glenn Villar @ 8/12/2008 9:36:22 AM
RE: replacing fields using SQL statements? Posted by Christian Tabligan @ 8/12/2008 9:40:11 AM
RE: replacing fields using SQL statements? Posted by Dianne Benedicto @ 8/12/2008 9:47:46 AM
RE: replacing fields using SQL statements? Posted by Christian Tabligan @ 8/12/2008 9:51:54 AM
RE: replacing fields using SQL statements? Posted by Dianne Benedicto @ 8/12/2008 10:08:44 AM
RE: replacing fields using SQL statements? Posted by Christian Tabligan @ 8/12/2008 10:15:04 AM
RE: replacing fields using SQL statements? Posted by Dianne Benedicto @ 8/12/2008 10:30:31 AM
RE: replacing fields using SQL statements? Posted by Glenn Villar @ 8/12/2008 10:04:03 AM
RE: replacing fields using SQL statements? Posted by Christian Tabligan @ 8/12/2008 10:06:09 AM
RE: replacing fields using SQL statements? Posted by Glenn Villar @ 8/12/2008 10:08:47 AM
RE: replacing fields using SQL statements? Posted by Christian Tabligan @ 8/12/2008 10:16:18 AM
RE: replacing fields using SQL statements? Posted by Dianne Benedicto @ 8/12/2008 10:16:33 AM
RE: replacing fields using SQL statements? Posted by Christian Tabligan @ 8/12/2008 10:17:46 AM
RE: replacing fields using SQL statements? Posted by Dianne Benedicto @ 8/12/2008 10:33:16 AM
RE: replacing fields using SQL statements? Posted by Christian Tabligan @ 8/12/2008 10:38:20 AM
RE: replacing fields using SQL statements? Posted by Glenn Villar @ 8/12/2008 10:46:36 AM
RE: replacing fields using SQL statements? Posted by Christian Tabligan @ 8/12/2008 10:50:52 AM
RE: replacing fields using SQL statements? Posted by Glenn Villar @ 8/12/2008 10:57:30 AM
RE: replacing fields using SQL statements? Posted by Dianne Benedicto @ 8/12/2008 10:55:20 AM
RE: replacing fields using SQL statements? Posted by Glenn Villar @ 8/12/2008 11:04:20 AM
RE: replacing fields using SQL statements? Posted by Dianne Benedicto @ 8/12/2008 10:15:09 AM
RE: replacing fields using SQL statements? Posted by Christian Tabligan @ 8/12/2008 10:17:07 AM
RE: replacing fields using SQL statements? Posted by Dianne Benedicto @ 8/12/2008 10:41:58 AM
RE: replacing fields using SQL statements? Posted by Christian Tabligan @ 8/12/2008 10:45:06 AM
RE: replacing fields using SQL statements? Posted by Anders Altberg @ 8/12/2008 11:03:29 AM
RE: replacing fields using SQL statements? Posted by Dianne Benedicto @ 8/12/2008 11:34:10 AM
RE: replacing fields using SQL statements? Posted by Anders Altberg @ 8/12/2008 11:39:25 AM
RE: replacing fields using SQL statements? Posted by Christian Tabligan @ 8/12/2008 12:03:04 PM
RE: replacing fields using SQL statements? Posted by Anders Altberg @ 8/12/2008 12:06:56 PM
RE: replacing fields using SQL statements? Posted by Christian Tabligan @ 8/12/2008 12:16:09 PM
RE: replacing fields using SQL statements? Posted by Anders Altberg @ 8/12/2008 2:37:59 PM
RE: replacing fields using SQL statements? Posted by Christian Tabligan @ 8/13/2008 1:37:43 AM
RE: replacing fields using SQL statements? Posted by suhas hegde @ 8/18/2008 9:34:27 AM
RE: replacing fields using SQL statements? Posted by Anders Altberg @ 8/18/2008 12:06:57 PM
RE: replacing fields using SQL statements? Posted by Christian Tabligan @ 8/14/2008 2:54:04 AM
RE: replacing fields using SQL statements? Posted by Dianne Benedicto @ 8/19/2008 3:16:17 AM
RE: replacing fields using SQL statements? Posted by Christian Tabligan @ 8/19/2008 6:30:36 AM
RE: replacing fields using SQL statements? Posted by Anders Altberg @ 8/14/2008 5:54:42 PM
RE: replacing fields using SQL statements? Posted by Glenn Villar @ 8/18/2008 3:08:54 AM
RE: replacing fields using SQL statements? Posted by Jim Booth @ 8/18/2008 4:06:05 AM
RE: replacing fields using SQL statements? Posted by Glenn Villar @ 8/18/2008 6:22:33 AM
RE: replacing fields using SQL statements? Posted by Anders Altberg @ 8/18/2008 11:58:04 AM
RE: replacing fields using SQL statements? Posted by Glenn Villar @ 8/18/2008 12:29:21 PM
RE: replacing fields using SQL statements? Posted by lopera @ 8/14/2008 3:27:18 AM
RE: replacing fields using SQL statements? Posted by Dianne Benedicto @ 8/14/2008 10:05:58 AM
RE: replacing fields using SQL statements? Posted by Anders Altberg @ 8/14/2008 6:02:54 PM