>>Unless you are running a lottery or something, I see no reason why you would want a random number. Generating of any random number implies the new number might already exist in the table.
>>
>>I also think it really unfortunate that you started by asking for a random number, and no one stops you to ask what do you intend to do with it. That resulted in a lot of noise that served no purpose.
>>
>>You seem to be requiring a number that is unique to each record. If not, please explain what you are doing.
>
>Yes, I do need a unique number to be set into a field of a table (not PK field). In VFP I have used the random number approach for this case and have not had any problems. Why could not the same work in SQL?
In VFP random number also doesn't guarantee to be unique. You may want to use NewID() (which is uniqueidentifier) if you need a unique value.
If it's not broken, fix it until it is.
My Blog