Declare @ZipCodeIDS varchar(100) set @ZipCodeIDS= null ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Android Enthusiasts

Q&A for enthusiasts and power users of the Android operating system

Declare @ZipCodeIDS varchar(100)
set  @ZipCodeIDS= null

Declare @listofIDS table(zipcodeids int)
    
    IF @ZipCodeIDS = '' SET @ZipCodeIDS = NULL
    IF @ZipCodeIDS IS NOT NULL
    BEGIN
  set @ZipCodeIDS+= ','
    ;with cte as
    (
    select substring(@ZipCodeIDS, 1, charindex(',', @ZipCodeIDS) - 1) num, charindex(',', @ZipCodeIDS) pos
    union all
    select substring(@ZipCodeIDS, pos + 1, charindex(',', @ZipCodeIDS, pos +1) - pos - 1) num, charindex(',', @ZipCodeIDS, pos +1)
    from cte
    where charindex(',', @ZipCodeIDS, pos +1) > 0

    )
    INSERT @listofIDS 
    select num from cte
END
select zipcodeids from @listofIDS

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results