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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Update based on anothe table
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

rama108
Posting Yak Master

115 Posts

Posted - 05/17/2013 :  14:26:18  Show Profile  Reply with Quote
how can i do this:

Update A
set Locked = b.Locked
FRom B b
where b.MID = MID

this is giving me erroe:
Ambiguous column name 'MID'.

djj55
Constraint Violating Yak Guru

USA
352 Posts

Posted - 05/17/2013 :  14:30:21  Show Profile  Reply with Quote
You need to associate A with B in a join thus
UPDATE A 
SET locked = b.locked
FROM A 
INNER JOIN B ON A.MID = B.MID


djj
Go to Top of Page

rama108
Posting Yak Master

115 Posts

Posted - 05/18/2013 :  08:46:06  Show Profile  Reply with Quote
Thanks Dj.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000