ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Update one column of table with data from another table in SQL Server<p>This is my below code i have used in my requirement. i have implemented different criteria by repeating conditions with order by triples doubles and single orders. (by begin and end) it performs mass update at a time.</p> <pre class="brush: sql">ALTER procedure [dbo].[sp_populatingnewSubunitId] as begin update t &nbsp;&nbsp;&nbsp; set [SubUnitID] = s.id &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FROM [dbo].[NewTravelerView] t &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; join [dbo].[tbl_SubUnit] s &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; on [CountryCode]= [WorkCountry] &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; and t.[SourceCompany]=s.[SourceCompany] and t.[HRCostCenter] =s.[HRCostCenter] and t.[WorkLocation]=s.[Location] and t.[WorkCompany]=s.[CompanyCode] &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHERE&nbsp; t.SubUnitID is null &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND t.[WorkCountry] is not null and t.[SourceCompany] is not null and t.[HRCostcenter] is not null and t.[WorkLocation] is not null and t.[WorkCompany] is not null and s.[Flag]=1 end end GO </pre> <p>&nbsp;</p> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/474977/Update-one-column-of-table-with-data-from-another-table-in-SQL-Server/https://www.aspforums.net:443/Threads/474977/Update-one-column-of-table-with-data-from-another-table-in-SQL-Server/Sat, 20 Oct 2018 14:16:19 GMT