this is the function:CREATE FUNCTION dbo.Split( @RowData nvarchar(2000), @SplitOn nvarchar(5)) RETURNS @RtnValue table ( Id int identity(1,1), Data nvarchar(100)) AS BEGIN While (Charindex ( @SplitOn,@RowData)>0) Begin Insert Into @RtnValue (data) Select Data = ltrim(rtrim(Substring( @RowData,1,Charindex ( @SplitOn,@RowData)-1))) Set @RowData = Substring( @RowData,Charindex ( @SplitOn,@RowData)+1,len( @RowData)) End Insert Into @RtnValue (data) Select Data = ltrim(rtrim(@RowData)) ReturnENDselect *from Table1 t1 inner join dbo.Split('1,2,3,4,5', ',') t2 on t1.Id = t2.DataIn data column are your id to which you join.Go with the flow & have fun! Else fight the flow