Update Table ...

Update Table ...

Post by Bill Kellaw » Thu, 25 Dec 2003 20:22:48



I have two tables in the same db.  Jobs and ImportedJobs.  The ImportedJobs
contains jobs that will update multiple records and multiple fields in the
jobs table.

I can't seem to get this work with even updating one field - I need to
potential update all of the fields ...

Here's where I'm at ..

UPDATE Jobs SET company  =
(Select company FROM ConvertedJobs
INNER JOIN Jobs ON Jobs.jobid = ConvertedJobs.jobid)
WHERE ConvertedJobs.Action ='Update';

Any help would be greatly appreciated !!

Happy Holidays ..

Bill

 
 
 

Update Table ...

Post by Denis Gob » Thu, 25 Dec 2003 20:27:49


UPDATE j SET company  = c.company
 FROM ConvertedJobs c
INNER JOIN Jobs j ON j.jobid = c.jobid
WHERE c.Action ='Update'


Quote:> I have two tables in the same db.  Jobs and ImportedJobs.  The
ImportedJobs
> contains jobs that will update multiple records and multiple fields in the
> jobs table.

> I can't seem to get this work with even updating one field - I need to
> potential update all of the fields ...

> Here's where I'm at ..

> UPDATE Jobs SET company  =
> (Select company FROM ConvertedJobs
> INNER JOIN Jobs ON Jobs.jobid = ConvertedJobs.jobid)
> WHERE ConvertedJobs.Action ='Update';

> Any help would be greatly appreciated !!

> Happy Holidays ..

> Bill


 
 
 

Update Table ...

Post by Wayne Snyde » Thu, 25 Dec 2003 20:34:46


try this

UPDATE Jobs SET company  = ConvertedJobs.company
FROM ConvertedJobs
 INNER JOIN Jobs ON Jobs.jobid = ConvertedJobs.jobid
 WHERE ConvertedJobs.Action ='Update';

--
Wayne Snyder, MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), C*te, NC
www.computeredservices.com
(Please respond only to the newsgroups.)

I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org


Quote:> I have two tables in the same db.  Jobs and ImportedJobs.  The
ImportedJobs
> contains jobs that will update multiple records and multiple fields in the
> jobs table.

> I can't seem to get this work with even updating one field - I need to
> potential update all of the fields ...

> Here's where I'm at ..

> UPDATE Jobs SET company  =
> (Select company FROM ConvertedJobs
> INNER JOIN Jobs ON Jobs.jobid = ConvertedJobs.jobid)
> WHERE ConvertedJobs.Action ='Update';

> Any help would be greatly appreciated !!

> Happy Holidays ..

> Bill

 
 
 

Update Table ...

Post by Bill Kellawa » Fri, 26 Dec 2003 00:30:37


Thanks all !!!

That did it .. Happy Holiday's once again !

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

 
 
 

1. update table w/o updating transaction log?

I have a couple of tables that are strictly used for maintaining a ton of
state information between dozens of stored procedures.  Rows are added
before the stored procedures start, updated along the way, used at the end
and then deleted.  They are completely unimportant when it comes to doing
backups or recovering from failure... is there any way to instruct SQL
Server 2000 SP2 that changes to certain tables can be ignored when it comes
to writing to the transaction log?

TIA,
John

 Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
    ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------        
                http://www.usenet.com

2. Change Package Owner

3. SqlSrv 7.0 NO update of creating date after updating table design

4. redundant New: Dim rs As New ADODB.Recordset

5. want update view but update table

6. Wanted ode to convert QBE to SQL

7. update table with variable for table name

8. Web Reports

9. Update table from another table

10. DTS Update table from Paradox tables

11. how VB update Table A INNER JOIN Table B, Set A.co=B.ID

12. Updating table 1 with table 2