Home Forums SQL Server 2005 T-SQL (SS2K5) update table using parameter variable RE: update table using parameter variable
PravB4u
Default port
Points: 1401
More actions
December 10, 2013 at 4:13 am
#1672245
DECLARE @sql varchar(max)
SET @sql = 'Update '+ @baseTable +' set Quantity = s.Quantity
from ' + @baseTable +' p , '+ @stageTbl +' s
where p.TimeKey = s.TimeKey and p.AccountId = s.AccountId and p.StockId=s.StockId'
EXEC (@sql)