Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Glen Villar
  Where is Glen Villar?
 Palayan City
 Philippines
 Glen Villar
 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: 188859 # Views: 1 # Ratings: 0
Version: Visual FoxPro 7 Category: Databases, Tables and SQL Server
Date: Tuesday, August 12, 2008 10:46:36 AM         
   


> Hi! Thanks for the help. I already run the form but the output is not the one I wanted. I need to copy/replace the student.studentid to personal.studentid. The two tables don't have the same number of records since student table was imported from SQL database. Please help!


Hi again Dianne!

I don't think there is a problem with using update on tables with unequal number of records. Try this example below:

Let's create a table and fill it with 3 records, then we'll extract 2 records from it. Makes changes on that 2 records except the mypk and see it will have an effect on UPDATE.


CREATE TABLE c:\testing (mypk c(4), myname c(40))
INSERT INTO testing(mypk, myname) values('0001', 'glenn')
INSERT INTO testing(mypk, myname) values('0002', 'marlon')
INSERT INTO testing(mypk, myname) values('0003', 'shiela')
SELECT * FROM testing WHERE val(mypk) < 3 INTO CURSOR test2 readwrite
Select Test2
BROWSE	&& at this point, make some changes into the records of test2 (leave the mypk field unchanged)
UPDATE testing SET testing.myname = test2.myname ;
WHERE testing.mypk = test2.mypk
SELECT testing
BROWSE




(coffee)

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