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.
| Author |
Topic |
|
mikebird
Aged Yak Warrior
529 Posts |
Posted - 2008-02-26 : 05:54:43
|
| I need to do an update. Can you tell me if it's possible to update multiple tables in a single statement when joined, as with a select, or this has to be taken care of in seperate statements with the same join? I'm sure this is a simple YES / NO answer.Here is what I'm using, with the same structure as somewhere else... why do I get 'incorrect syntax near q' on that very first line?-- Do the updateupdate ccs_quotes q set ccs_quo_user_date#1 = j.completedfrom "ken-sql-002".hettonhosttestdatabase.dbo.job jinner join ccs_quotes qon left(j.cid,10) = q.ccs_quo_ref_number#2where completed is not nulland ccs_quo_ref_number#2 = 'SHGD40021'Thanks a lotMike |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-02-26 : 05:57:55
|
quote: Originally posted by mikebird I need to do an update. Can you tell me if it's possible to update multiple tables in a single statement when joined, as with a select, or this has to be taken care of in seperate statements with the same join? I'm sure this is a simple YES / NO answer.Here is what I'm using, with the same structure as somewhere else... why do I get 'incorrect syntax near q' on that very first line?-- Do the updateupdate ccs_quotes q set ccs_quo_user_date#1 = j.completedfrom "ken-sql-002".hettonhosttestdatabase.dbo.job jinner join ccs_quotes qon left(j.cid,10) = q.ccs_quo_ref_number#2where completed is not nulland ccs_quo_ref_number#2 = 'SHGD40021'Thanks a lotMike
You dont need both table name and alias here. Use either one of these |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-02-26 : 05:58:35
|
quote: Originally posted by mikebird I need to do an update. Can you tell me if it's possible to update multiple tables in a single statement when joined, as with a select, or this has to be taken care of in seperate statements with the same join? I'm sure this is a simple YES / NO answer.Here is what I'm using, with the same structure as somewhere else... why do I get 'incorrect syntax near q' on that very first line?-- Do the updateupdate ccs_quotes q set ccs_quo_user_date#1 = j.completedfrom "ken-sql-002".hettonhosttestdatabase.dbo.job jinner join ccs_quotes qon left(j.cid,10) = q.ccs_quo_ref_number#2where completed is not nulland ccs_quo_ref_number#2 = 'SHGD40021'Thanks a lotMike
Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
mikebird
Aged Yak Warrior
529 Posts |
Posted - 2008-02-26 : 06:07:09
|
| It became very obvious very quickly! I rushed back to cancel the post but you were too quick. How embarrassing.I wish I could delete this post |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-02-26 : 07:31:07
|
| <<I wish I could delete this post>>Dodnt do that. That would prevent others from LearningMadhivananFailing to plan is Planning to fail |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-02-26 : 10:46:15
|
quote: Originally posted by mikebird It became very obvious very quickly! I rushed back to cancel the post but you were too quick. How embarrassing.I wish I could delete this post
Though you have realised & learned this quickly by posting this you are helping many others who actually dont know this. So NEVER EVER delete your original posts. Thanks. |
 |
|
|
|
|
|
|
|