I wish to do something like the following:
declare @FrameNumber nvarchar(20)
set @FrameNumber = \'(p1, p2)\'
select from myTable where c1 in @FrameNumber
final solution:
DECLARE @FrameNumbers TABLE (FrameNumber NVARCHAR(20) PRIMARY KEY)
DECLARE @pos int
SET @pos=CHARINDEX(',',@FrameNumber)
WHILE @pos>0 BEGIN
INSERT @FrameNumbers SELECT LEFT(@FrameNumber,CHARINDEX(',',@FrameNumber)-1)
SET @FrameNumber = SUBSTRING(@FrameNumber,CHARINDEX(',',@FrameNumber)+1,LEN(@FrameNumber))
SET @pos=CHARINDEX(',',@FrameNumber)
END
IF LEN(@FrameNumber)>0 BEGIN
INSERT @FrameNumbers SELECT @FrameNumber
END
select from myTable where c1 in (select FrameNumber from @FrameNumbers)
thanks Quassnoi and Sam, this solution is just a combination of your solutions.