SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Problems With RAND()


Problems With RAND()

Author
Message
Steve Jones
Steve Jones
SSC Guru
SSC Guru (403K reputation)SSC Guru (403K reputation)SSC Guru (403K reputation)SSC Guru (403K reputation)SSC Guru (403K reputation)SSC Guru (403K reputation)SSC Guru (403K reputation)SSC Guru (403K reputation)

Group: Administrators
Points: 403779 Visits: 20465
Show how RAND() works with the same seed over time. Also, how RAND() might work in an insert statement with a) one and b)multiple rows.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Dave Poole
Dave Poole
SSC-Forever
SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)

Group: General Forum Members
Points: 42340 Visits: 3857
When you say "Same seed over time" are you talking about using time as a seed?

I'll take this article on.

LinkedIn Profile
www.simple-talk.com
Steve Jones
Steve Jones
SSC Guru
SSC Guru (403K reputation)SSC Guru (403K reputation)SSC Guru (403K reputation)SSC Guru (403K reputation)SSC Guru (403K reputation)SSC Guru (403K reputation)SSC Guru (403K reputation)SSC Guru (403K reputation)

Group: Administrators
Points: 403779 Visits: 20465
It's yours, David.

Sorry, my verbiage was poorly chosen there. I meant using RAND() in a set, getting the same values returned from a call.

As opposed to NewID()

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Dave Poole
Dave Poole
SSC-Forever
SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)SSC-Forever (42K reputation)

Group: General Forum Members
Points: 42340 Visits: 3857
I've just submitted the article on RAND(). I'm not sure if it is quite what you had in mind.

Let me know and I will alter it as you see fit.

LinkedIn Profile
www.simple-talk.com
Steve Jones
Steve Jones
SSC Guru
SSC Guru (403K reputation)SSC Guru (403K reputation)SSC Guru (403K reputation)SSC Guru (403K reputation)SSC Guru (403K reputation)SSC Guru (403K reputation)SSC Guru (403K reputation)SSC Guru (403K reputation)

Group: Administrators
Points: 403779 Visits: 20465
Thanks, closing this for now.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search