Skip to content

Commit a208e0a

Browse files
Update Markov Chain Recursion.sql
1 parent af4a27e commit a208e0a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Permutations, Combinations, Sequences and Random Numbers/Recursion Examples/Markov Chain Recursion.sql

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ On average, how many rainy days are there in Probability Land?
1616
-------------------------------
1717
-------------------------------
1818

19-
DROP TABLE if EXISTS #Probabilities;
20-
DROP TABLE if EXISTS #Numbers;
21-
DROP TABLE if EXISTS #RandomNumbers;
19+
DROP TABLE IF EXISTS #Probabilities;
20+
DROP TABLE IF EXISTS #Numbers;
21+
DROP TABLE IF EXISTS #RandomNumbers;
2222
DROP TABLE IF EXISTS #ProbabilitesFinal;
2323
GO
2424

@@ -43,17 +43,17 @@ GO
4343
DECLARE @vTotalNumbers INTEGER = 10000;
4444
-------------------------------
4545
-------------------------------
46-
WITH cte_Number (Number)
46+
WITH cte_Recursion (Number)
4747
AS (
4848
SELECT 1 AS Number
4949
UNION ALL
5050
SELECT Number + 1
51-
FROM cte_Number
51+
FROM cte_Recursion
5252
WHERE Number < @vTotalNumbers
5353
)
5454
SELECT Number AS StepNumber
5555
INTO #Numbers
56-
FROM cte_Number
56+
FROM cte_Recursion
5757
OPTION (MAXRECURSION 0);
5858

5959
-------------------------------
@@ -107,4 +107,4 @@ SELECT [Description],
107107
FROM #ProbabilitesFinal
108108
GROUP BY [Description]
109109
ORDER BY 1;
110-
GO
110+
GO

0 commit comments

Comments
 (0)