searchsanjaysharma
asked on
How to update multiples tables with similar values with single update command.
update mstchvs set quarter='P1' where ltrim(rtrim(month)) in('October','November','D ecember') and year=2010
I want to do this similar update from t1,t2,t3,t4
How to achieve this.
I want to do this similar update from t1,t2,t3,t4
How to achieve this.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
With Dynamic SQL it would be possible to use varibles for tables and columns but I also suggest to use separate Update Statements instead of dynamic Sql.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This i was already doing it. But i liked comment by jimhorn, Thanks to all.
DECLARE @i1 INT
SET @i1 = 100
DECLARE @string11 NVARCHAR(50)
SET @string11 = 'MyString'
SELECT * FROM dbo.t1 WHERE dbo.t1.Col1 = @i1