SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 All combinations question
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Rasta Pickles
Posting Yak Master

United Kingdom
169 Posts

Posted - 02/16/2013 :  08:22:06  Show Profile  Reply with Quote
I have a table with 4 columns titled: Player Name, Player Position, Projected Points, Player Salary.

I have a total of 103 players that consist of Center, Forward and Guard positions. Each player has a position, projected points value, and salary value.

I need to know all possible 8 player combinations (lineups) that have the highest projected point value with a total salary under $100,000. The 8 player lineup will consist of 2 guards, 2 forwards, 2 centers and the final 2 can be any of the 3 (utility).

Is this do-able in SQL?

Thanks for your input.

Rasta Pickles
Posting Yak Master

United Kingdom
169 Posts

Posted - 02/16/2013 :  15:08:24  Show Profile  Reply with Quote
Well thanks for the replies, much appreciated.

I cobbled together some code myself but it falls over complaining about

Msg 530, Level 16, State 1, Line 3

The statement terminated. The maximum recursion 100 has been exhausted before statement completion.


So I guess I'll have to try a grown up language.

C# maybe? Anyone know what language would be best for this? I'm running an i7 on 32GB of RAM so resources aren't an issue.
Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3323 Posts

Posted - 02/16/2013 :  15:16:41  Show Profile  Reply with Quote
I don't really have a solution for you - couple of thoughts/suggestions though:

a) Since it is the weekend (and a long weekend for many people in the United States), much fewer people may be on the forum - that may explain the lack of responses.

b) While I vaguely understand the question you are asking, it is hard for me to visualize the problemand even harder to write a query or think of an algorithm without some concrete data. I suspect the same for many others on the forum. So if you post sample data in a consumable format, that may elicit more responses. Since you already have a query, even if it does not work, if you post that (including the ddl for the tables, so someone can copy, paste and run it), that would help.

c) You can always increase the maximum recursion limit by specifying OPTION (MAXRECURSION N) at the very end of your query. N is an integer. If N is 0, that indicates no limit. But first try with a larger number than 100 - sometimes, infinite recursion resulting out of some flaw in the logic may be causing the "max recursion exceeded" message
Go to Top of Page

ravi.kashyap
Starting Member

India
4 Posts

Posted - 02/17/2013 :  13:11:23  Show Profile  Reply with Quote
sir,
i have a .BAk file of my sql 2000 and i have to retrieve data from this file .how can i do this ??????
Go to Top of Page

Rasta Pickles
Posting Yak Master

United Kingdom
169 Posts

Posted - 02/17/2013 :  14:29:20  Show Profile  Reply with Quote
quote:
Originally posted by ravi.kashyap

sir,
i have a .BAk file of my sql 2000 and i have to retrieve data from this file .how can i do this ??????



God bless you sir for responding but I'm not sure your post adds anything to what I've already seen.

I wish you well.
Go to Top of Page

singularity
Posting Yak Master

151 Posts

Posted - 02/18/2013 :  18:42:46  Show Profile  Reply with Quote
I'm actually very curious about this, so I've made up some sample data in hopes of somebody coming up with a solution:


CREATE TABLE PLAYERS
   (	PLAYER_NAME VARCHAR(50), 
	PLAYER_POSITION VARCHAR(7), 
	PROJECTED_POINTS INT, 
	PLAYER_SALARY INT
   )


INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Dexter Figueroa','Guard',892,19144)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Kevin Harvey','Forward',813,15782)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Dalton Rosa','Center',901,11658)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Neil Armstrong','Guard',485,8538)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Brian Mann','Center',626,7939)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Joshua Savage','Guard',671,10196)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Hunter Clayton','Guard',547,12623)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Dalton Oneal','Center',774,7651)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Barry Hodges','Center',462,13280)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Solomon Hurst','Center',343,14668)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Brady Petersen','Guard',400,5801)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Wade Peterson','Center',404,14971)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Charles Knight','Center',322,6031)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Mason Dixon','Guard',897,17365)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Hall Potter','Center',726,11999)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Carson Rivers','Center',501,11576)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Murphy Gallegos','Center',209,11252)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Kibo Craig','Guard',766,6175)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Adam Haney','Center',402,7872)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Emery Norman','Guard',367,13736)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Barrett Harding','Center',224,16009)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Nero Pierce','Center',724,6016)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Dillon Donovan','Forward',351,19759)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Dolan Cooper','Guard',768,14282)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Raymond Barron','Center',730,12532)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Eaton Randall','Guard',219,18788)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Graiden Powell','Center',689,9511)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Joel Todd','Guard',293,16056)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Rahim Hensley','Forward',220,14735)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Preston Sexton','Forward',651,10324)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Keefe Stone','Forward',640,6923)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Gannon Weiss','Forward',535,12135)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Elton Watson','Guard',806,12404)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Lars Lucas','Guard',764,18945)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Chase Jones','Guard',640,9877)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Curran Burris','Forward',666,16305)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Ignatius White','Forward',991,6948)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Robert Fry','Forward',351,17550)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Michael Roy','Guard',480,6342)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Jerry Lynch','Center',552,6815)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Lane Oneal','Center',229,17391)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Keane Lambert','Forward',887,16660)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Graiden Nunez','Forward',899,9235)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Elliott Marsh','Center',325,11505)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Randall Oconnor','Forward',973,11356)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Ishmael Maynard','Center',510,7198)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Kareem Weeks','Center',386,12800)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Brendan Morales','Forward',301,6066)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Jakeem Howell','Guard',326,16868)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Adrian Weeks','Guard',459,11549)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Hall Sanders','Center',636,10999)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Maxwell Britt','Center',560,13809)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Slade Mayer','Forward',834,10300)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Brent Fitzpatrick','Guard',899,19426)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Kane Sweet','Forward',912,8621)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Hop Freeman','Forward',876,13995)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Stuart Lawson','Forward',893,7307)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Rigel Pierce','Forward',829,12808)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('George Valentine','Forward',744,15279)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Caldwell Deleon','Center',409,11959)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Elijah Phelps','Forward',359,14316)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Xavier Blackwell','Center',443,5176)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Rudyard Burns','Guard',332,12869)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Baker Marquez','Guard',811,6794)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Kennan Velasquez','Center',204,14237)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Len Garner','Center',762,13104)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Addison Obrien','Center',485,18792)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Cameron Collins','Center',801,8100)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Harrison Shaffer','Guard',781,12996)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Zeph Fox','Center',566,11972)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Wing Blair','Forward',575,12422)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Sawyer Joyce','Forward',715,12949)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Gannon Santiago','Forward',782,12050)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Levi Chandler','Forward',230,5419)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Uriel Ballard','Forward',506,16855)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Shad Gomez','Guard',724,10024)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Bruno King','Forward',970,11941)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Samuel Gilmore','Center',812,5093)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Alfonso Harris','Forward',833,8111)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Forrest Petersen','Center',289,14364)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Isaiah Whitney','Forward',691,14414)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Micah Reed','Center',256,6357)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Wylie Valencia','Center',583,7964)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Damian Kramer','Center',880,10719)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Lewis Cruz','Center',929,8226)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Jackson Hatfield','Forward',801,16935)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Beck Hood','Center',956,14317)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Eaton Valdez','Guard',329,5221)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Wade Hess','Guard',872,10655)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Tucker James','Center',474,12517)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Connor Shepard','Forward',446,14733)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Clayton Heath','Center',704,5474)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Garrison Warren','Guard',756,6613)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Vaughan Moran','Center',342,10460)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Samson Branch','Forward',294,7661)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Valentine Gordon','Center',818,9860)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Igor Woodard','Guard',802,10374)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Kuame Campos','Center',248,19970)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Macon Young','Center',569,17250)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Joseph Fowler','Forward',789,5457)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Kamal Nielsen','Guard',601,7359)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Thane Witt','Center',640,18438)
INSERT INTO PLAYERS (PLAYER_NAME,PLAYER_POSITION,PROJECTED_POINTS,PLAYER_SALARY) VALUES ('Yardley Carrillo','Forward',755,6409)
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000