SELECT id,A as Data FROM tblSample WHERE not isnull(A) UNION ALL
SELECT id,B as Data FROM tblSample WHERE not isnull(B) UNION ALL
SELECT id,C as Data FROM tblSample WHERE not isnull(C) UNION ALL
SELECT id,D as Data FROM tblSample WHERE not isnull(D);
try:SELECT *
FROM [select id,a from b105q where id=1 union select id,b from b105q where id=1 union
select id,c from b105q where id=1 union select id,d from b105q where id=1
union select id,a from b105q where id=2 union select id,b from b105q where id=2
union select id,c from b105q where id=2 union select id,d from b105q where id=2
union select id,a from b105q where id=3 union select id,b from b105q where id=3
union select id,c from b105q where id=3 union select id,d from b105q where id=3]. AS [%$##@_Alias]
WHERE not isnull(a);