ACIPin의 기본 키 'pkey'인 CDRLive에 'IPkey'라는 새 열을 추가하려고합니다. pkey는 bigint이며 null이 아닙니다.새 열을 추가하고 외래 키 관계 설정
ALTER TABLE CDRLive ADD IPkey bigint NOT NULL
go
ALTER TABLE CDRLive
ADD CONSTRAINT CDRLive_IPkey FOREIGN KEY(IPkey) REFERENCES ACIPin(pkey)
실패했습니다. 이 오류는 : 당신이 원하는 경우
Msg 4901, Level 16, State 1, Line 2
ALTER TABLE only allows columns to be added that can contain nulls, or have a DEFAULT definition specified, or the column being added is an identity or timestamp column, or alternatively if none of the previous conditions are satisfied the table must be empty to allow addition of this column. Column 'IPkey' cannot be added to non-empty table 'CDRLive' because it does not satisfy these conditions.
Msg 1769, Level 16, State 1, Line 1
Foreign key 'CDRLive_IPkey' references invalid column 'IPkey' in referencing table 'CDRLive'.
Msg 1750, Level 16, State 0, Line 1
Could not create constraint. See previous errors.
실행 후 오류 메시지? –
오류가 업데이트되었습니다. –
'IPkey'와'ACIPin.pkey'는 같은 컬럼 정의를 가지고 있습니까? –