[dba-SQLServer] SQL to create Integer Random

Arthur Fuller fuller.artful at gmail.com
Mon Mar 24 14:28:21 CDT 2008


Create a column of data type uniqueidentifier and give it the default
NewID(). That should do it.
A.

On Mon, Mar 24, 2008 at 11:55 AM, jwcolby <jwcolby at colbyconsulting.com>
wrote:

> It has to be permanent random number.  I have to select the top N records
> but they have to be random records within the table.  I also have to date
> stamp the records selected to indicate that they have been selected and on
> which date.
>
> The way I normally attack this is to create a random int field and a
> SelectedDate field, and populate the random int field.  I then update the
> top N date field (sorted by random int field where date = null).  I then
> select those with today's data and ship them out, but ordered by Zip / +4.
>
> Mailing label orders.
>
>
>



More information about the dba-SQLServer mailing list