Actually, time should still be seconds for this kind of query.
> Select ma.Region, sa.Login
> From MasterAccounts ma, SubAccounts sa
> Where ma.Region = 'xxxxxx'
> Order by sa.Login, ma.Region
> Go
The reason you are running out of space, if you haven't linked the
masteraccounts and subaccounts table. Therefore, SQL Server is giving
you the cartesian results of all possible combinations. If you have
5000 MBRs and 5000 subaccounts, that would be 5000*5000 which would
result in 25 million records returned. :)
So just add the ma.CustomerID = sa.CustomerID to the where
clause and all should be fine.
> Msg 1105, Level 17, State 1
> Can't allocate space for object '-1250' in database 'tempdb' because the
> 'system' segment is full. If you ran out of space in Syslogs, dump the
> transaction log. Otherwise, use ALTER DATABASE or sp_extendsegment to
> increase the size of the segment.
> Msg 1510, Level 17, State 2
> Sort failed: Out of space or locks in database 'tempdb'
-- Dale E. Reed Jr. (daler@iea-software.com)_________________________________________________________________ IEA Software, Inc. | RadiusNT, Emerald, and NT FAQs Internet Solutions for Today | http://www.iea-software.com