Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2014
    Posts
    1

    Unanswered: Removing duplicate delimited values from a single column

    I've searched the web, but most everything is about removing duplicate *rows* from a result set...which is not my issue. I have a stored procedure that returns a single row based on a parameter of employee ID. This particular procedure uses a CTE to traverse our org structure. One of the columns is returning a delimited string of Windows login values and due to the business rules, it can contain duplicate values. I need to have that column contain only unique values - no dupes.

    For example, this one column could contain something like this:

    domain\user1;domain\user2;domain\user2;domain\user 3;

    The need is to convert to this:
    domain\user1;domain\user2;domain\user3;

    I know that's a tall order. Appreciate any assistance.

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Modify the CTE to use DISTINCT.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •