【问题标题】:SQL Server 2008 dynamic query doubt [duplicate]SQL Server 2008动态查询疑问[重复]
【发布时间】:2011-08-26 21:14:04
【问题描述】:

可能的重复:
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,我有这行要执行,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)

【问题讨论】:

    标签: sql-server-2008


    【解决方案1】:

    spt_valuesmaster 数据库中的一个表。因此,它仅供内部 SQL Server 使用,对公众未记录

    基本上,您拥有的代码是获取数字结果集的快速方法。

    【讨论】:

    • 那么type='P'
    • 我正在搜索,它说是用于投影,但这是什么意思?
    猜你喜欢
    • 1970-01-01
    • 2013-02-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多