SQL Azure에서 기본 키를 변경하려고합니다. 그러나 Microsoft SQL Server Management Studio를 사용하여 스크립트를 생성 할 때 오류가 발생합니다. SQL Azure의 모든 테이블에는 기본 키가 있어야하기 때문입니다. 그리고 나는 그것을 만들기 전에 그것을 떨어 뜨릴 수 없다. 변경해야 할 경우 어떻게해야합니까?SQL Azure에서 기본 키를 변경하는 방법
는 스크립트
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[mytable]') AND name = N'PK_mytable')
ALTER TABLE [dbo].[mytable] DROP CONSTRAINT [PK_mytable]
GO
ALTER TABLE [dbo].[mytable] ADD CONSTRAINT [PK_mytable] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF)
GO
을 생성 나는이 정확한 문제에 달려 포럼에 푸른 팀에 연락
Msg 40054, Level 16, State 2, Line 3
Tables without a clustered index are not supported in this version of SQL Server. Please create a clustered index and try again.
Msg 3727, Level 16, State 0, Line 3
Could not drop constraint. See previous errors.
The statement has been terminated.
Msg 1779, Level 16, State 0, Line 3
Table 't_event_admin' already has a primary key defined on it.
Msg 1750, Level 16, State 0, Line 3
Could not create constraint. See previous errors.
놀랍도록 간단한 답변입니다. 수출과 레크리에이션을 구현하는 것은 처음에는 두뇌가 뒤틀린 것 같았지만 결국 엔 너무 우아했습니다. – krillgar