Free for PREMIUM members
Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.
CREATE TABLE #TempTable (
INSERT INTO #temptable
DECLARE @Xml AS XML
DECLARE @WhereClause VARCHAR(MAX)
SET @WhereClause = '1,2,3,4'
SET @Xml = cast(('<A>' + replace(@WhereClause, ',', '</A><A>') + '</A>') AS XML)
WHERE #TempTable.ID IN (
SELECT A.value('.', 'varchar(max)') AS [Column]
FROM @Xml.nodes('A') AS FN(A)
Open in new window
DECLARE @p1 varchar(max)
declare @Splitter char(1)
SET @Splitter = ','
SET @p1 = '2,3,4,5'
SELECT CAST('<v>' + REPLACE(@p1, @Splitter, '</v><v>') + '</v>' AS XML) AS Split
persons as (
select 1 as personID, 11 as whatever union all
select 2 as personID, 22 as whatever union all
select 3 as personID, 33 as whatever union all
select 4 as personID, 44 as whatever union all
select 5 as personID, 55 as whatever union all
select 6 as personID, 66 as whatever union all
select 7 as personID, 77 as whatever union all
select 8 as personID, 88 as whatever union all
select 9 as personID, 99 as whatever
where (@p1 is null
personID IN (
SELECT cast(x.v.value('.', 'bigint') as bigint) AS Value
CROSS APPLY Split.nodes('//v') x(v)
Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.