2011-05-17 97 views
0

可能重複:
What is the purpose of system table table master..spt_values and what are the meanings of its values?
Why (and how) to split column using master..spt_values?SQL Server 2008的動態查詢疑問

我有一些動態的SQL,我有這樣的線將要執行的spt_values, and the type='P'什麼意思

declare @Sql nvarchar(max) 
select @Sql = ISNULL(@sql + ',', '') + QUOTENAME(RIGHT(number,10)) 
    from master..spt_values 
    where type='P' and number between 1 and (select COUNT(*) From tableName) 

回答

0

spt_valuesmaster數據庫中的表格。因此,它僅供內部SQL Server使用,並且未向公衆公開

基本上你得到的代碼是一個快速的方式來獲得數字結果集。

+0

以及'type ='P'' – cMinor 2011-05-17 01:27:43

+0

它沒有證件。 – 2011-05-17 01:30:56

+0

我在搜索,它說是用於投影,但是它是什麼意思? – cMinor 2011-05-17 01:31:49