Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Move data from one table to another - one column is changing 1

Status
Not open for further replies.

Sypher2

Programmer
Oct 3, 2001
160
US
I need to move data from one table to another. The two tables have identical structures. Obviously I can use:
Code:
INSERT INTO Table 2 SELECT * FROM Table 1
However one column needs to change. Is there a way to plug in this new value during the INSERT INTO statement or am I stuck having to update every row that was inserted?

Example:
Table 1 has the following column values:
1. 4/1/2006 8:01:56 AM
2. 15000
3. 20000

Table 2 needs to have:
1. 4/1/2006 8:00:00 AM
2. 15000
3. 20000

Thanks
 
Code:
INSERT INTO Table2;
SELECT DateTime(2006,1,4,8,0,0), field2, fleid3 FROM Table1

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
 
OOOOOOOOOOOOOOOOOOOOOOOO
Veery sorry for this post. I think I read VFP forums :-(
Try this:
Code:
INSERT INTO TABLE2
SELECT CAST('2006-04-01 08:00:00' as datetime), Field2, Field3 FROM Table1

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top