日期:2014-05-18 浏览次数:20709 次
--> 测试数据:[t1] if object_id('[t1]') is not null drop table [t1] create table [t1]([Username] varchar(1)) insert [t1] select 'a' union all select 'b' union all select 'c' union all select 'd' --> 测试数据:[t2] if object_id('[t2]') is not null drop table [t2] create table [t2]([Username] varchar(1),[NUN] varchar(1)) insert [t2] select 'a','X' union all select 'b','Y' union all select 'c','Z' union all select 'd','M' update t1 set [Username]=a.[NUN] from t2 a where t1.Username=a.Username select * from t1 /* Username X Y Z M */