Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 update table multiple rows

Author  Topic 

Zath
Constraint Violating Yak Guru

298 Posts

Posted - 2009-09-09 : 09:39:05
I have the following information in TBL2:

68 69
71 72
74 75
68 76
80 79
82 81
84 83

the first column refers to TBL1 - it's primary key
The second is a column in TBL1 that needs to be updated.

So, update TBL1 SET colX = 69 WHERE colPK = 68

I have done this before but just can't remember or find where.

Thanks,

Zath

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-09-09 : 09:41:08
What is your expected result?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Zath
Constraint Violating Yak Guru

298 Posts

Posted - 2009-09-09 : 09:46:58
Just trying to update one table from another table.

Been looking at this but just can't seem to get it working...

http://msdn.microsoft.com/en-us/library/aa260662(SQL.80).aspx

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-09-09 : 09:57:25
But your query specifies that you want to update on the same table
What have you tried?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Zath
Constraint Violating Yak Guru

298 Posts

Posted - 2009-09-09 : 10:06:56
worded what I needed wrong.

I got it working. Had the wrong column name in the query LOL.....
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-09-10 : 02:29:38
quote:
Originally posted by Zath

worded what I needed wrong.

I got it working. Had the wrong column name in the query LOL.....


Post the workable query

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -