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

Help with an update query from 1 table to another... 1

Status
Not open for further replies.

Webkins

Programmer
Dec 11, 2008
118
US
I am using MSSql 2000
I have 2 tables within 1 database: coilspec and wirespec
Both tables have these 2 columns and datatypes in common: coil(varchar) and wire1(varchar)
The column in wire1 in table coilspec is blank.
I am tring to populate the column coilspec.wire1 with the data from wirespec.wire1 based on the coilspec.coil column which contains the part number.
Here is what I have so far but it is not working...

UPDATE coilspec.dbo.coilspec SET wire1 = (SELECT wire1 FROM coilspec.dbo.wirespec) where coil = coil

Am I even close?

Many thanks to all the experts out there for your help...
 
Close....

Code:
BEGIN TRANSACTION;
UPDATE coilspec.dbo.coilspec 
SET wire1 = ws.coil
FROM coilspec.dbo.wirespec ws
WHERE coilspec.dbo.coilspec.coil = ws.coil;

... wrote freehand, so check it before committing.

--------------------------------------------------
“Crash programs fail because they are based on the theory that, with nine women pregnant, you can get a baby a month.” --Wernher von Braun
--------------------------------------------------
 
ABSOLUTELY PERFECT, THANKS FOR THE HELP!
Have a * on me.

:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top