December 5, 2016 at 3:36 am
Hi all,
I am looking to create a table of 1000 rows, uniquely identified by a number (1,2,3...1000), but the second column should use the NORMINV function from excel
=NORMINV(probability, mean, standard_dev)
whilst creating the 1000 rows, i would like to set/change the mean and stdev therefore require parameters.
so it should look something like this...
DECLARE
@i int = 1,
@mean float = 2.3,
@stdev float = 2.0;
WHILE @i < 1000
BEGIN
INSERT INTO table1 (rowID, distribution)
VALUES (@i, NORMINV(RAND(), @mean, @stdev) )
SET @i = @i + 1
END
RAND() is a excel function, but will be simple enough to code that in sql.
Many thanks in advance
December 5, 2016 at 3:39 am
RAND() is also a T-SQL function.
https://msdn.microsoft.com/en-us/library/ms177610.aspx
Igor Micev,My blog: www.igormicev.com
December 5, 2016 at 3:43 am
it is! just tried it.
thanks
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply