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.
Author |
Topic |
helixpoint
Constraint Violating Yak Guru
291 Posts |
Posted - 2014-10-22 : 10:19:53
|
I want to combine 2 unrelated tables so I am doing a cross join. The problem is the combination brings back several millon records. This is for me to do a test on a stored proc. Is the a way to get a random set back for say 40000 recordsSELECT e.LastName, e.Id AS empID, t.Id AS TeamID, t.NameFROM dbo.tblEmployee AS e CROSS JOIN dbo.tblTrkTeam AS t DaveHelixpoint Web Developmenthttp://www.helixpoint.com |
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2014-10-22 : 10:54:55
|
use TOP(nnn) Percent |
|
|
lazerath
Constraint Violating Yak Guru
343 Posts |
Posted - 2014-10-24 : 12:05:43
|
As far as I know, the engine will still return a relatively consistent resultset with TOP (nnn) PERCENT. Instead, use it in conjunction with ORDER BY NEWID() to guarantee uniqueness. |
|
|
|
|
|