SQL Azure not recognizing my clustered Index

狂风中的少年 提交于 2019-12-05 17:17:19
Andomar

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

As far as I can see, your statement does conform to the Azure create table spec.

Be careful if you're using SSIS. I ran into this same problem, myself, but was using SSIS instead of manually inserting the data. By default SSIS will drop and recreate the table, so even though I had it properly defined with a clustered index, my SSIS script failed. On the "Edit Mappings" step in the SSIS wizard you can manually define the table creation script. I just deleted the table gen script there and my import worked.

(I'd leave this as a comment but my post count is too anemic)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!