DECLARE @TEMP1 TABLE(ID INT,Name NVARCHAR(30),Ex INT) DECLARE @TEMP2 TABLE(ID INT,Name NVARCHAR(30),Ex INT) INSERT INTO @TEMP1(ID,Name,Ex) SELECT 1,'1',0 UNION ALL SELECT 2,'2',0 UNION ALL SELECT 3,'3',0 UNION ALL SELECT 4,'4',0 UNION ALL SELECT 5,'5',0 UNION ALL SELECT 6,'6',0 UNION ALL SELECT 7,'7',0 INSERT INTO @TEMP2(ID,Name,Ex) SELECT 1,'1',0 UNION ALL SELECT 2,'2',0 UNION ALL SELECT 3,'3',0 UNION ALL SELECT 4,'4',0 UNION ALL SELECT 5,'5',0 UNION ALL SELECT 6,'6',0 UNION ALL SELECT 7,'7',0 UPDATE @TEMP1 SET Name = 2 FROM @TEMP1 AS T1 LEFT JOIN @TEMP2 AS T2 ON T1.ID = T2.ID SELECT * FROM @TEMP1
UPDATE FROM
------------------------------------------
除非特别声明,文章均为原创,版权与博客园共有,转载请保留出处
BUY ME COFFEE
![](https://images.cnblogs.com/cnblogs_com/kkun/212569/o_200616035329WechatIMG237.png)
![](https://images.cnblogs.com/cnblogs_com/kkun/212569/o_200616035334WechatIMG238.jpeg)