I am using a CROSS JOIN function to create a view. The code that I have found is like below.
SELECT tbl.*
,y.GOAL_VERSION_NO
FROM EVALGOAL_GROUP_EMP AS tbl
CROSS JOIN (SELECT TOP (SELECT MAX(GOAL_VERSION_NO) FROM GOAL) * FROM(VALUES(1),(2),(3),(4),(5) /*add the max count here*/) AS x(GOAL_VERSION_NO)) AS y
In this code sample, the output of SELECT MAX(GOAL_VERSION_NO) FROM GOAL
can be any value, per say it can be 1-1000. But I learned only to insert the CROSS JOIN values as VALUES (1),(2),(3)
and so on as I did in my code. Is there any way I can enter a unlimited amount of cross join values here(By unlimited I mean maximum of 1000 and it's difficult to hard code like above and sometime it can be more than 1000).
Please help me. Thank you.