create table table1(ID1 varchar(10),ID2 varchar(10))
insert table1 
select 'String1','String2'
union all 
select 'String3',Null
union all 
select 'String4','String5'
union all 
select Null,'String6'select distinct * from 
(
select ID1 from table1
union all
select ID2 from table1
) a where ID1 is not null
drop table table1
/*
ID1
----------
String1
String2
String3
String4
String5
String6(6 行受影响)
*/