SQL Azure的不承认我的聚集索引 [英] SQL Azure not recognizing my clustered Index

查看:159
本文介绍了SQL Azure的不承认我的聚集索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到以下错误,当我尝试插入一行到SQL Azure的表。

I get the following error when I try to insert a row into a SQL Azure table.

没有一个聚集索引的表,在这个版本不支持
  SQL Server中。请创建一个聚集索引,然后重试。

Tables without a clustered index are not supported in this version of SQL Server. Please create a clustered index and try again.

我的问题是我有该表的聚集索引。我使用了SQL Azure的兆瓦生成Azure的SQL脚本。

My problem is I do have a clustered index on that table. I used SQL Azure MW to generate the Azure SQL Script.

下面就是我使用的是什么:

Here's what I'm using:

IF  EXISTS (SELECT * FROM sys.objects
    WHERE object_id = OBJECT_ID(N'[dbo].[tblPasswordReset]') AND type in (N'U'))
DROP TABLE [dbo].[tblPasswordReset]
GO
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
IF NOT EXISTS (SELECT * FROM sys.objects
    WHERE object_id = OBJECT_ID(N'[dbo].[tblPasswordReset]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[tblPasswordReset](
    [PasswordResetID] [int] IDENTITY(1,1) NOT NULL,
    [PasswordResetGUID] [uniqueidentifier] NULL,
    [MemberID] [int] NULL,
    [RequestDate] [datetime] NULL,
 CONSTRAINT [PK_tblPasswordReset] PRIMARY KEY CLUSTERED 
(
    [PasswordResetID] ASC
)WITH (STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF)
)
END
GO

为什么不SQL Azure中承认我的聚集键?是我的脚本错误?

Why doesn't SQL Azure recognize my clustered Key? Is my script wrong?

推荐答案

您脚本只创建表,如果不存在,就。或许还有一个旧版本的表没有一个聚集索引?你可以用:

Your script only creates the table if it did not exist yet. Perhaps there still is an old version of the table without a clustered index? You can check with:

select * from sys.indexes where object_id = object_id('tblPasswordReset')

如果该表不存在聚集索引,你可以添加一个这样的:

If the table exists without the clustered index, you can add one like:

alter table tblPasswordReset add constraint
    PK_tblPasswordReset primary key clustered

据我所看到的,你的发言不符合的Azure创建表SPEC

这篇关于SQL Azure的不承认我的聚集索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆