Viewing 15 posts - 1,936 through 1,950 (of 3,957 total)
I'll help a little further. The script you posted (althought syntactically incorrect) does exactly what the RN_MULTINOMIAL function does:
UPDATE BOOKINGS
SET DepartureDate
CASE WHEN RAND() Result = Between 0 and 0.3...
February 20, 2013 at 5:30 pm
Perhaps one additional clarification.
To generate a single multinomial random number, you do it like this:
SELECT MNRN=dbo.RN_MULTINOMIAL(@MultinomialProbabilities, URN)
FROM (SELECT URN=RAND(CHECKSUM(NEWID()))) a
Provided because I wasn't sure if when you referring to your...
February 20, 2013 at 8:48 am
Here is how to generate a sample set of multinomially distributed random numbers. First, you need to create a TYPE and a FUNCTION by running this script:
CREATE TYPE Distribution...
February 20, 2013 at 8:39 am
OK. Give me a few minutes and I'll code up an example.
February 20, 2013 at 8:11 am
wafw1971 (2/20/2013)
February 20, 2013 at 7:09 am
wafw1971 (2/20/2013)
SELECT ArrivalDate, DATEADD(day, 1 + RAND(checksum(NEWID()))
* LengthOfStay.LengthofStay, ArrivalDate) AS DepartureDate ...
February 20, 2013 at 3:38 am
Jeff Moden (2/19/2013)
February 19, 2013 at 5:12 pm
Jeff Moden (2/18/2013)
dwain.c (2/17/2013)
You can also do this with a recursive CTE, which can be put into an iTVF.See the first example, in the third article in my signature links.
Yes,...
February 18, 2013 at 5:31 pm
In looking at this, I don't think you need to use a temp table. However in order to show you how, you'd need to provide:
- DDL for your [EODVolumeStats]...
February 17, 2013 at 6:21 pm
You can also do this with a recursive CTE, which can be put into an iTVF.
See the first example, in the third article in my signature links.
February 17, 2013 at 6:08 pm
Something like this perhaps?
;WITH MyData (orderid, Invoice, netprice, pricechange) AS (
SELECT 1234,98989,39.99,' '
UNION ALL...
February 17, 2013 at 5:48 pm
Forgive me but isn't this easily done as follows?
;WITH AuditDates (AgentID, AuditDate, Completed) AS (
SELECT 54321, '2013-01-01', 1
UNION ALL SELECT 54321,'2013-01-15', 1
...
February 13, 2013 at 11:13 pm
Sergiy (2/13/2013)
dwain.c (1/15/2013)
February 13, 2013 at 7:14 pm
Magoo you've done it again!
Pretty fast for sure.
The record counts I posted might have been before I made some changes to the test harness.
February 13, 2013 at 6:09 pm
You can try something like this:
-- Create temporary tables.
CREATE TABLE #permutations(id TINYINT)
CREATE TABLE #items (item varchar(20))
-- Insert two rows for permutations.
INSERT INTO #permutations
VALUES (1)
INSERT INTO #permutations
VALUES (2)
-- Insert Items to...
February 13, 2013 at 5:51 pm
Viewing 15 posts - 1,936 through 1,950 (of 3,957 total)