"Sets" in SQL?

  • Does t-sql have any support for mathematical sets. I'd like to treat a row as a set and perform differences, intersections, etc it.

    For example:

    (1,2,3,4,5) MINUS (1,4,7) = (2,3,5)

    (1,2,3,4,5) INTERSECT ( 2,7) = (2)

    where (1,2,3,4,5) are 5 fields in a single row.

    TIA,

    Bill

  • I don't know of any way to do this with multiple columns in a single row.... but this seems like an easy one for a child table where SQL performs "SET" operations magnificently.

    Gaurddata-

  • Interesting idea.

    Article at http://www.sqlmag.com/Articles/Index.cfm?ArticleID=38812 where Itzik Ben-Gan discuss idea of using array sets for performance gains.

    Basically, use a varbinary(?) as an array to store 4 digit numbers. Still needs a bit of code.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply