this isn't exactly a new tip, but if you don't know, you can select a random id from a table using the following syntax:
select top 1
f
from
t
order by
newid()
so... if you need to perform random performance tests, you can use the above to retrieve a random id and then test against it. here's an example:
declare @v varchar(20)
select top 1
@v = cityname
from
zipcode
order by
newid()
select
*
from
zipcode
where
cityname = @v
very simple, yes. but effective for quick testing. =)
Monday, March 19, 2007 9:16 PM