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 |
|
sinjin67
Yak Posting Veteran
53 Posts |
Posted - 2009-01-02 : 19:00:17
|
| Having a little trouble with this one.. I am trying to updateTable A from Table B..Here is my basic SP and the error I getI cant seem to figure what I missed.Thanks for the helpCREATE PROCEDURE dbo.changeover1UPDATE label01 us1id = litid, us1 = lit1a, email = lit2a,FROM Label01 INNER JOIN YakOn label01.us1id = Yak.us1idWHERE label01.us1id = Yak.us1id GOMsg 156, Level 15, State 1, Procedure changeover1, Line 3Incorrect syntax near the keyword 'UPDATE'. |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2009-01-02 : 19:47:50
|
| UPDATE label01 setus1id = litid,us1 = lit1a,email = lit2a,FROM Label01 INNER JOIN YakOn label01.us1id = Yak.us1idWHERE label01.us1id = Yak.us1idAlso, although it does no harm, you don't need the where clause because that is already taken care of in the join condition. |
 |
|
|
sinjin67
Yak Posting Veteran
53 Posts |
Posted - 2009-01-02 : 23:42:59
|
| I left the "where" in because I was just not sure..But at least I got close. Thanks for the help...I am greatful for the pointin the right direction... |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-03 : 06:40:20
|
i prefer using aliases for tables rather than repeating table names everywhere UPDATE l setus1id = litid,us1 = lit1a,email = lit2a,FROM Label01 lINNER JOIN Yak yOn l.us1id = y.us1id |
 |
|
|
|
|
|
|
|