I wish to do something like the following:
declare @FrameNumber nvarchar(20)
set @FrameNumber = \'(p1, p2)\'
select from myTable where c1 in @FrameNumber
CREATE FUNCTION [dbo].[func_ParseStringToTable] (@stringIN varchar(2000))
RETURNS @tOUT TABLE(RoomID int) AS
BEGIN
DECLARE @pos int
SET @pos=CHARINDEX(',',@StringIN)
WHILE @pos>0
BEGIN
INSERT @tOUT(RoomID) SELECT LEFT(@StringIN,CHARINDEX(',',@StringIN)-1)
SET @stringIN = SUBSTRING(@StringIN,CHARINDEX(',',@StringIN)+1,LEN(@StringIN))
SET @pos=CHARINDEX(',',@StringIN)
END
IF LEN(@StringIN)>0
BEGIN
INSERT @tOUT(RoomID) SELECT @StringIN
END
RETURN
END
usage...
SELECT * FROM table WHERE id IN (func_ParseStringToTable(@ids))