相关疑难解决方法(0)

在表变量上创建索引

你能index在一个表变量上创建SQL Server 2000吗?

DECLARE @TEMPTABLE TABLE (
        [ID] [int] NOT NULL PRIMARY KEY
        ,[Name] [nvarchar] (255) COLLATE DATABASE_DEFAULT NULL 
)
Run Code Online (Sandbox Code Playgroud)

我可以在Name上创建索引吗?

sql t-sql sql-server indexing table-variable

178
推荐指数
2
解决办法
29万
查看次数

使用SQL Server在CREATE TABLE语句中创建非聚簇非唯一索引

可以在SQL Server CREATE TABLE语句中创建主键或唯一索引.是否可以在CREATE TABLE语句中创建非唯一索引?

CREATE TABLE MyTable(
    a int NOT NULL
    ,b smallint NOT NULL
    ,c smallint NOT NULL
    ,d smallint NOT NULL
    ,e smallint NOT NULL

    -- This creates a primary key
    ,CONSTRAINT PK_MyTable PRIMARY KEY CLUSTERED (a)

    -- This creates a unique nonclustered index on columns b and c
    ,CONSTRAINT IX_MyTable1 UNIQUE (b, c)

    -- Is it possible to create a non-unique index on columns d and e here?
    -- Note: these variations would not …
Run Code Online (Sandbox Code Playgroud)

sql-server

78
推荐指数
4
解决办法
12万
查看次数

标签 统计

sql-server ×2

indexing ×1

sql ×1

t-sql ×1

table-variable ×1