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

Straight copy of one record to another same table and column

Status
Not open for further replies.

limester

Technical User
Dec 29, 2004
69
CA
Hi,

Can someone tell me the way to do a straight copy of a record as an update without using a select statement ?

I tried
update table
set column.field
where field2 = 'value1'
and field2 = 'value2'

Thanks!
 
You need to specify what you want to set the destination field equal to. You should also need to specify a link between the tables if you are updating one with a value from another. Also, I am not sure what you mean by column.field: do you mean table.field? In your example it would read something like:

Code:
update table
set table.field = source_table.source_table_field
where source_table.source_table_field = destination_table.link_field
and field2 = 'value1'
and field2 = 'value2'

replacing the source and destination tables and fields with your own of course.

Hope this helps


Geraint

The lights are on but nobody's home, my elevator doesn't go to the top. I'm not playing with a full deck, I've lost my marbles. Barenaked Ladies - Crazy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top