jwcolby
jwcolby at colbyconsulting.com
Mon Mar 24 14:58:35 CDT 2008
Exactly right. You have to perform two casts() to make it happen though. I will post the exact syntaxt as soon as I am finished with the order. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller Sent: Monday, March 24, 2008 3:28 PM To: Discussion concerning MS SQL Server Subject: Re: [dba-SQLServer] SQL to create Integer Random 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. > > > _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com