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
 Development Tools
 Other Development Tools
 running newid() in enterprise manager or asp

Author  Topic 

csphard
Posting Yak Master

113 Posts

Posted - 2005-11-18 : 17:34:25
I am getting different results when it comes to getting data randomly.

using asp I get similiar results.

using enterprise manager it is random

The statment is the following. Can anyone tell me if using order by
newid() works different in one environment vs the other.


select l.lname,l.fname,l.empid,l.item,l.pay_location,l.sub,
l.bureau,l.division,l.eval_type, l.begindate,l.enddate,l.bname,l.dname
from
( select top 200 e.lname,e.fname,e.empid,e.item,e.pay_location,e.sub,e.bureau,e.division,d.eval_type,
convert(varchar,d.fromdate,101) as begindate, convert(varchar,d.todate,101) as enddate,
o.org_name as bname, n.org_name as dname
from emp_information_test e,due_evals d,new_organization o,new_organization n
WHERE e.item Not in (0845,1004,1060,2574,8008,8013,8014,8015,8016,8017,8019,8023,8645,9421)
and e.deptno <> '999' and e.empid = d.empid and d.eval_type <> 'Probation'
and e.bureau is not null and e.bureau = o.org_id and o.type = 'BUREAU'
and e.division = n.org_id and n.type = 'DIVISION' and datepart(yyyy,d.datetobefiled ) = '2005'
and e.empid LIKE '_[45]%' order by NEWID() ) L order by L.bureau,L.division,L.pay_location,L.empid

graz
Chief SQLTeam Crack Dealer

4149 Posts

Posted - 2005-11-18 : 17:46:10
It depends on the operating system that's hosting SQL Server. Are they both pointing at the database server?

http://www.sqlteam.com/item.asp?ItemID=8747

===============================================
Creating tomorrow's legacy systems today.
One crisis at a time.
Go to Top of Page

csphard
Posting Yak Master

113 Posts

Posted - 2005-11-18 : 18:10:12
Yes they are pointing to the same database. but it seems that the enterprise manager is more random.

Go to Top of Page
   

- Advertisement -