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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy one table to another

Status
Not open for further replies.

WaveOut

Programmer
Sep 6, 2002
42
US
Hello,
I would like to copy the contents of one table to another with the following twist ... I need to copy the entire table just as it is except for one field. I want to supply the value for this one field.

Example:

Table1
id 1
firstname John
lastname Doe
wage null

Table2
id
firstname
lastname
wage

I need to copy the contents (several hundred records) of Table 1 to Table2. Rather than copy the null wage I want to supply the value for that field. I'm using the following to copy the data as is.

Insert into Table2(firstname,lastname,wage) Select(firstname,lastname,wage) from Table1

Some how I need to set the value of wage.

Thanks,
Dave
 
Code:
insert 
  into Table2
     ( firstname,lastname,wage ) 
select firstname,lastname, 937.00 
  from Table1

r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top