General information
Category:
Coding, syntax & commands
>>>>What's a better way to do a random "quote for the day"?
>>>
>>>What is your back-end?
>>>
>>>In SQL Server to generate a random record you will use
>>>
>>>select top 1 * from myTable order by NewID()
>>>
>>>In VFP I would agree with Sergey about generating random record using rand() function.
>>
>>Does that really work in SQL Server? I had not thought of using NewID in that way.
>
>Yes it works, because NewID generates a GUID which is a 128 bits random integer.
The part I didn't (don't?) understand is how those IDs are associated with existing records in the table.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only