You can try this
declare @TempTable1 table (UserName nvarchar(128) primary key, FirstName nvarchar(128), LastName(128)) insert into @TempTable1 select 'user1', 'John', 'Deer' union all select 'user2', 'Jane', 'Farmer' union all select 'user3', 'Gill', 'Bate' update table1 set FirstName = t2.FirstName, LastName = t2.LastName from table1 as t inner join @TempTable1 as t2 on t2.UserName = t.UserName
Or if you want to update only changed fields
update table1 set FirstName = isnull(t2.FirstName, t.FirstName), LastName = isnull(t2.LastName, t.LastName) from table1 as t inner join @TempTable1 as t2 on t2.UserName = t.UserName
For a C # client application, I believe the usual way is to create a procedure
create procedure sp_Table1_Update ( @UserName nvarchar(128), @FirstName nvarchar(128), @LastName nvarchar(128) ) as begin update table1 set FirstName = @FirstName, LastName = @LastName where UserName = @UserName end
and then call it from the application for each user
source share