March 8, 2013 at 6:58 am
Hi All,
I want to update multiple columns from multiple tables in a single UPDATE Query...
Just want to do like below query...
UPDATE Table1, Table2
SET Table1.Column1 = 'one'
,Table2.Column2 = 'two'
FROM Table1 T1, Table2 T2
WHERE T1.id = T2.id
and T1.id = 'id1'
Does Sql Server 2008 provide any mechanism to do so?
If Sql Server 2008 provide such nice approach, please share some links with me!
Thanks!
March 8, 2013 at 8:00 am
No you cannot do this. Ref BOL here
The view referenced by table_or_view_name must be updatable and reference exactly one base table in the FROM clause of the view
______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience
March 8, 2013 at 8:00 am
No such feature exists. Wrap the two updates in a single transaction is what you want.
The probability of survival is inversely proportional to the angle of arrival.
March 8, 2013 at 8:08 am
Sql Server doesn't allow it but according to MSDN Visual Studio gives you a bypass on that.
http://msdn.microsoft.com/en-us/library/f5scy1hs(v=VS.80).aspx
March 11, 2013 at 6:18 am
Thanks,
But i want to know one thing.
Is this applicable in SQL Server 2008.
Reply with your view.....
March 11, 2013 at 6:21 am
A single update statement can only update a single table, that's in any version of SQL Server
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
March 11, 2013 at 8:11 am
Thanks,
got your point!
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply