January 25, 2008 at 11:41 am
Debra Owens (1/25/2008)
After running several test the top 1000... will not work with the query.The user name and date is being queried, member quired is not one of the 1000 returned therefore, no items selected.
When I run it with the udf random it works.
Debra - the "top 1000" was there for my purposes (the test table was rather large). I just wanted to highlight the Checksum(NewID()) method....
You absolutely don't need the TOP n syntax if your case doesn't lend itself to it.
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
January 25, 2008 at 11:48 am
I removed the top 1000 and it worked.
I added abs to insure a positive number.
abs(checksum(newID()))
😉
March 2, 2011 at 9:35 am
This is about 3 years too late, but it worked for me:
SELECT [Field1]
, ROW_NUMBER() OVER (ORDER BY [Field1]) AS 'Row Number'
FROM [dbo].[MyTable]
Viewing 3 posts - 16 through 17 (of 17 total)
You must be logged in to reply to this topic. Login to reply