Microsoft
Software
Hardware
Network
Question : Using rand() to generate data
I am trying to generate test data. I have one table that has a list of dates, another that has a list of residents. I want to generate a metric that is 1 80% of the time, and 0 the other 20%. Presumably, a random generator function needs to be employed.
Here's what I have:
SELECT D.ActualDay, R.RESIDENT_ID, 1 AS 'Metric'
FROM DIM_DATE AS D, DIM_RESIDENT AS R
Which generates my data except my metric is always 1. I did try using rand() and got a random number in the metric field, but it was the same number repeated over and over. I want a stored procedure, which I can run that will populate a table having fields day, resident, metric using the dates from DIM_DATE and the residents from DIM_RESIDENT.
Answer : Using rand() to generate data
RAND(
CAST( NEWID() AS varbinary )
)
Random Solutions
aspnet, gridview.. Trimming the data in the bound controls
Jquery javascript error
word/excel don't show any printers on terminal server, but outlook/notepad/IE/etc work perfectly
Outlook 2007 keeps bombing every five minutes or so. Send error report?
DNS and Exchange problems
Public IP
Microsoft Hyper-V Server 2008 R2 - Is there a benefit to a small organisation?
How can I add a total cost for each row that has at least one dynamic checkbox checked?
Debian 5 Lenny cannot connect via SSH with alternate user
delay notifications from AOL and GT.RR.COM, exchange 2003