Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 subset function to generate all possible combos?

Author  Topic 

steelkilt
Constraint Violating Yak Guru

255 Posts

Posted - 2003-11-20 : 10:33:59
Hi. I notice SQL Server 7.0 has a subset function which should allow me to generate all possible combinations from a master set. However, when I attempt to test this function, it bombs. Anyone have an example, similar to what I described above, that works on v. 7.0?

thx.

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2003-11-20 : 10:43:20
SUBSET is an MDX function, not a T-SQL function.

Jay White
{0}
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-11-20 : 10:50:13
Cross join ?

- Jeff
Go to Top of Page

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2003-11-20 : 14:42:20
This sort of thing:

DECLARE @setsize int
SET @setsize = 9

SELECT S.n, B.n
FROM Numbers AS S
INNER JOIN Numbers AS B ON S.n & POWER(2, B.n) > 0
WHERE S.n BETWEEN 0 AND POWER(2, @setsize)-1
AND B.n BETWEEN 0 AND @setsize-1

Go to Top of Page
   

- Advertisement -