Find in Set for MSSQL?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mr aldo
    New Member
    • Jul 2007
    • 15

    #1

    Find in Set for MSSQL?

    Hello...

    I have been searching for about an hour, Google and this site but I have yet to find it.

    I have been trying to find the MSSQL equivalent to the MySQL function FIND_IN_SET(str , strlist) which can be used in the WHERE clause. So if you have a str of 1 and a strlist of 1,2,3 it would return 1, or a bool of true because it is in that list.

    I have been trying to find it, but no one has actually answered the question... I have not seen a CREATE FUNCTION for FIND_IN_SET, or even something that remotely helps.

    If anyone can help it would be greatly appreciated
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Depending on what you need or how you will use it, you can use one of these:

    IN()

    or

    CHARINDEX()

    or

    PATINDEX()

    or

    LIKE

    Happy Coding!

    -- CK

    Comment

    • Mr aldo
      New Member
      • Jul 2007
      • 15

      #3
      Thanks... I will try to get one working :)

      Comment

      Working...