Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
SELECT * FROM t1
WHERE c1 IN (1, 2, 3)
CREATE PROC myproc
@list varchar(1000)
AS
SELECT * FROM t1
WHERE c1 IN (@list)
CREATE PROC myproc
@list varchar(1000)
AS
EXEC('SELECT * FROM t1 WHERE c1 IN (' + @list + ')')
CREATE PROC apGetList
@list varchar(1000)
AS
SET NOCOUNT ON
DECLARE @pos int
--create table to hold parsed values
CREATE TABLE #list (val varchar(10))
--add comma to end of list
SET @list = @list + ','
--loop through list
WHILE CHARINDEX(',', @list) > 0
BEGIN
--get next comma position
SET @pos = CHARINDEX(',', @list)
--insert next value into table
INSERT #list VALUES (LTRIM(RTRIM(LEFT(@list, @pos - 1))))
--delete inserted value from list
SET @list = STUFF(@list, 1, @pos, '')
END
--now get data from your table using JOIN to temp table
SELECT col1, col2
FROM table1 t1 JOIN #list t2 ON t1.col1 = t2.val
EXEC apGetList '123,test,a1b2c'