When you have a variable that hold a comma separated numbers like '1,2,3' and you have a table with a column that has the value that should match a number in that list, you can use this script to avoid building a string and then executing it.
You have to convert the columnID to varchar, the size of the varchar must be the biggest size that the number can have, for example if ColumnID range from 0 to 9999, the varchar will be varchar(4).
The list MUST NOT have spaceses between the numbers, if so, the script will not work.
Creating a PDF from a Stored Procedure in SQL Server
A short but interesting article, the author has figured out a way to create a PDF from a stored procedure without using a third party library.
2019-09-20 (first published: 2003-08-26)
73,169 reads