![ContractedBlock.gif](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![ExpandedBlockStart.gif](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
CREATE
DATABASE
T
create table A
(
ID int ,
UserName nvarchar ( 50 )
)
create table B
(
ID int ,
UserDisplayName nvarchar ( 50 )
)
insert into A values ( 1 , ' USER1 ' );
insert into A values ( 2 , ' USER2 ' );
insert into A values ( 3 , ' USER3 ' );
insert into B values ( 1 , ' Display1 ' );
insert into B values ( 2 , ' Display2 ' );
insert into B values ( 3 , ' Display3 ' );
insert into B values ( 4 , ' Display4 ' )
update A set A.UserName = B.UserDisplayName from A,B where A.ID = B.ID
create table A
(
ID int ,
UserName nvarchar ( 50 )
)
create table B
(
ID int ,
UserDisplayName nvarchar ( 50 )
)
insert into A values ( 1 , ' USER1 ' );
insert into A values ( 2 , ' USER2 ' );
insert into A values ( 3 , ' USER3 ' );
insert into B values ( 1 , ' Display1 ' );
insert into B values ( 2 , ' Display2 ' );
insert into B values ( 3 , ' Display3 ' );
insert into B values ( 4 , ' Display4 ' )
update A set A.UserName = B.UserDisplayName from A,B where A.ID = B.ID
效果如图所示: