2011-05-17 95 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