database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
PostgreSQL
Firebird
Oracle
Informix
ㆍSybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
Sybase Q&A 2409 게시물 읽기
No. 2409
Primary key and Foreign key 문제여..
작성자
달선
작성일
2009-02-07 17:37
조회수
8,770


먼저 table을 create 할때는 Primary key 나 Foreign Key 설정을 안했습니다.

그리고 나서 


BOOK 테이블에


alter table BOOK

add PRIMARY KEY (Book_id) 

이렇게 해서 만들구여


 또 PUBLISHER 테이블에는


alter table BOOK

add PRIMARY KEY(Name)


이렇게 해놓은 상태에서여

BOOK 테이블에 Publisher_name 이라는 것과 PUBLISHER table 에 Name 과 연결하고 싶은데여


alter table

add FOREIGN KEY(Publisher_name)

references PUBLISHER (Name) 


이렇게 하니까

There is no unique constraint on the referend column in the referend table PUBLISHER specified in referential contraint declation BOOK 


머 이렇게 나오는데...

어떻게 해야 하는지도 모르곘고,


Table은 그냥 두고 , PRIMARY KEY setting 해놓은거를 지우고 싶은데... 어떻게 해야하나요!!!

알려주세야!!!!

이 글에 대한 댓글이 총 1건 있습니다.

There is no unique constraint on the referend column in the referend table PUBLISHER specified in referential contraint declation BOOK 
는 
PUBLISHER table에 primary key의 속성인 unique key 가 없어서 발생하는 것임
PUBLISHER table에 (Name)으로 unique index를 만들거나 primary key를 생성하면 문제해결

기존의 primary key 속성을 없애고자 하는 경우는 
sp_helpconstraint BOOK 또는 PUBLISHER
하면 constraint name이 나타납니다.

이 이름을 사용
alter table BOOK drop constraint constraint_name 으로 drop하면 됨,,

top님이 2009-02-09 11:22에 작성한 댓글입니다. Edit
[Top]
No.
제목
작성자
작성일
조회
2412덤프를 엎을려는데 다음과같은 에러가 뜹니다. [1]
한성빈
2009-02-12
7871
2411Sybase 의 실 서버 테이블만 백업 받아서 test에 부을순 없을까요? [2]
happynewmind
2009-02-12
8588
2410특정 행에서 중복된 이름을 제거... [1]
궁금
2009-02-09
8340
2409Primary key and Foreign key 문제여.. [1]
달선
2009-02-07
8770
2408날짜로 구성되어 있는 필드에서 월별로 인덱스를 뽑아내고 싶습니다. [1]
shadow
2009-02-07
8693
2407Character set 'eucksc' is not installed .... [9]
황재훈
2009-02-06
12637
2406sqllocres -r sqlloc.rs 에러.... [2]
황재훈
2009-02-06
9409
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.021초, 이곳 서비스는
	PostgreSQL v16.2로 자료를 관리합니다