日期:2014-05-17 浏览次数:20617 次
select '1','PP,*' union all
select '1','*' union all
select '1','PP' union all
select '2','uu,*' union all
select '2','uu' union all
select '2','*' union all
select '3','' union all
select '3','*'
select '1','PP,*'
select '2','UU,*'
select '3','*'
--select '1' id,'PP,*'NAME INTO #A
-- union all
--select '1','*' union all
--select '1','PP' union all
--select '2','uu,*' union all
--select '2','uu' union all
--select '2','*' union all
--select '3','' union all
--select '3','*'
--select '1' id,'PP,*' NAME INTO #B
--union all
--select '2','UU,*'
--union all
--select '3','*'
SELECT * FROM #a
SELECT * FROM #b
UPDATE #a
SET #a.name=#b.name
FROM #b
WHERE #a.id=#b.id
/*
id NAME
---- ----
1 PP,*
1 PP,*
1 PP,*
2 UU,*
2 UU,*
2 UU,*
3 *
3 *
*/
select '1' id,'PP,*' descr INTO #a union all
select '1','*' union all
select '1','PP' union all
select '2','uu,*' union all
select '2','uu' union all
select '2','*' union all
select '3','' union all
select '3','*'
select '1' id,'PP,*' descr INTO #b union all
select '2','UU,*' union all
selec