What is the purpose of system table master..spt_values and what are the meanings of its values?

前端 未结 3 1066
逝去的感伤
逝去的感伤 2020-11-22 10:08

What is the purpose of system table master..spt_values?
Why was it provided and how one should use it?

What are the meanings of its type, low, high values?

3条回答
  •  名媛妹妹
    2020-11-22 10:38

    One usage, definitely not its primary usage, is to generate a series of numbers:

    --Generate a series from 1 to 100
    SELECT
        TOP 100
        ROW_NUMBER() OVER(ORDER BY (SELECT NULL)) AS RowNum
    FROM master.dbo.spt_values ORDER BY RowNum
    

提交回复
热议问题