Thank you so much.
-----Original Message-----
From: "sql language" <sql_language@p...>
Sent: Tuesday, July 09, 2002 3:12 PM
To: "sql language" <sql_language@p...>
Subject: [sql_language] RE: Random Dates
try:
select convert(char(10),convert(datetime,cast(cast(newid()as varbinary)as
int)/50000),101)
Nick
-----Original Message-----
From: herbe@a... [mailto:herbe@a...]
Sent: 09 July 2002 15:07
To: sql language
Subject: [sql_language] RE: Random Dates
Thank you that worked.
One quick question how do I get rid of the time part of the field? I just want a
date
EXAMPLE: 07/09/2002
Thanks Again
-----Original Message-----
From: "sql language" <sql_language@p...>
Sent: Tuesday, July 09, 2002 2:38 PM
To: "sql language" <sql_language@p...>
Subject: [sql_language] RE: Random Dates
try:
select convert(datetime,cast(cast(newid()as varbinary)as int)/100000) -- returns
dates between 1870-1950
select convert(datetime,cast(cast(newid()as varbinary)as int)/10000) -- returns
dates from 1770-2250 and Arithmetic overflow error converting expression to data
type datetime(values too large or small).
select convert(datetime,cast(cast(newid()as varbinary)as int)/50000) -- returns
a reasonable range
no doubt you can find a divisor that will meet you needs
Nick
-----Original Message-----
From: herbe@a... [mailto:herbe@a...]
Sent: 09 July 2002 14:16
To: sql language
Subject: [sql_language] RE: Random Dates
This does not do dates
-----Original Message-----
From: "sql language" <sql_language@p...>
Sent: Wednesday, July 03, 2002 2:53 PM
To: "sql language" <sql_language@p...>
Subject: [sql_language] RE: Random Dates
Select top1 datefield from table order by newid()
This works if the dates are stored in a field
if not look up the rand() function
-----Original Message-----
From: herbe@a... [mailto:herbe@a...]
Sent: Wednesday, July 03, 2002 1:54 PM
To: sql language
Subject: [sql_language] Random Dates
Could T-SQL pick random dates?
*********************************************************************
This message and any attachments are confidential and should only be read by
those to whom they are addressed. If you are not the intended recipient, please
contact us, delete the message from your computer
and destroy any copies. Any distribution or copying without our prior permission
is prohibited.
The Achilles Group does not accept legal responsibility for the
contents of this message. The recipient is responsible for verifying
its authenticity before acting on the contents. Any views or opinions
presented are solely those of the author and do not necessarily
represent those of the Achilles Group.
This email has been scanned by MAILsweeper and Sophos Anti-Virus
products. However, The Achilles Group will have no liability for any
viruses contained in this email or any attachment with this email.
*********************************************************************
*********************************************************************
This message and any attachments are confidential and should only be read by
those to whom they are addressed. If you are not the intended recipient, please
contact us, delete the message from your computer
and destroy any copies. Any distribution or copying without our prior permission
is prohibited.
The Achilles Group does not accept legal responsibility for the
contents of this message. The recipient is responsible for verifying
its authenticity before acting on the contents. Any views or opinions
presented are solely those of the author and do not necessarily
represent those of the Achilles Group.
This email has been scanned by MAILsweeper and Sophos Anti-Virus
products. However, The Achilles Group will have no liability for any
viruses contained in this email or any attachment with this email.
*********************************************************************