if SQL 2005 & laterselect pkVal, name,valfrom table1unpivot (val for id in ([id1],[id2],[id3],[id4],[id5]))uwhere val=2
if earlier versionsselect pkval,name,idfrom(select pkval,name,id1 as idfrom table1union allselect pkval,name,id2from table1union allselect pkval,name,id3from table1union allselect pkval,name,id4from table1union allselect pkval,name,id5from table1)twhere id = 2
------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/