There are no primary or candidate keys in the referenced table 'factIngresosCurso' that match the referencing...
up vote
-2
down vote
favorite
Help please, I'm always getting this message:
There are no primary or candidate keys in the referenced table 'factIngresosCurso' that match the referencing column list in the foreign key 'fk_ingresos_curso'.
My tables:
create table factIngresos
(
cicCod char(6),
curcod char(5) references dimCurso,
cursec char(2),
codSec char(1) references dimSeccion,
tiempoid int references dimTiempo,
codHor int references dimHorario,
proCodUno char(5) references dimPersonal,
vacantes int,
inscritos int,
ingresoProyectado money,
ingresoNeto money,
becas money default 0,
constraint pk_Ingresos primary key(cicCod, curCod, curSec)
)
go
create table factIngCursoAlumno
(
alucod char(8) references dimAlumno,
cursec char(2), ciccod char(6), curcod char(5),
alucurCosto float, alucurefe float,
alucurPF float,
constraint pk_facIC primary key(alucod, cursec, ciccod, curcod),
constraint fk_ingresos_curso
foreign key(cursec, ciccod, curcod) references factIngresos(cursec, ciccod, curcod)
)
go
sql sql-server foreign-keys
add a comment |
up vote
-2
down vote
favorite
Help please, I'm always getting this message:
There are no primary or candidate keys in the referenced table 'factIngresosCurso' that match the referencing column list in the foreign key 'fk_ingresos_curso'.
My tables:
create table factIngresos
(
cicCod char(6),
curcod char(5) references dimCurso,
cursec char(2),
codSec char(1) references dimSeccion,
tiempoid int references dimTiempo,
codHor int references dimHorario,
proCodUno char(5) references dimPersonal,
vacantes int,
inscritos int,
ingresoProyectado money,
ingresoNeto money,
becas money default 0,
constraint pk_Ingresos primary key(cicCod, curCod, curSec)
)
go
create table factIngCursoAlumno
(
alucod char(8) references dimAlumno,
cursec char(2), ciccod char(6), curcod char(5),
alucurCosto float, alucurefe float,
alucurPF float,
constraint pk_facIC primary key(alucod, cursec, ciccod, curcod),
constraint fk_ingresos_curso
foreign key(cursec, ciccod, curcod) references factIngresos(cursec, ciccod, curcod)
)
go
sql sql-server foreign-keys
1
Your foreign key is referencingfactIngresosCurso
, which is not defined in the question. Hence there is not enough information.
– Gordon Linoff
Nov 11 at 14:51
Possible duplicate of There are no primary or candidate keys in the referenced table that match the referencing column list in the foreign key
– philipxy
Nov 11 at 19:28
This is a faq. Please always google many clear, concise & specific versions/phrasings of your question/problem/goal with & without your particular strings/names & read many answers. Add relevant keywords you discover to your searches. If you don't find an answer then post, using 1 variant search as title & keywords for tags. See the downvote arrow mouseover text. When you do have a non-duplicate code question to post please read & act on Minimal, Complete, and Verifiable example.
– philipxy
Nov 11 at 19:29
add a comment |
up vote
-2
down vote
favorite
up vote
-2
down vote
favorite
Help please, I'm always getting this message:
There are no primary or candidate keys in the referenced table 'factIngresosCurso' that match the referencing column list in the foreign key 'fk_ingresos_curso'.
My tables:
create table factIngresos
(
cicCod char(6),
curcod char(5) references dimCurso,
cursec char(2),
codSec char(1) references dimSeccion,
tiempoid int references dimTiempo,
codHor int references dimHorario,
proCodUno char(5) references dimPersonal,
vacantes int,
inscritos int,
ingresoProyectado money,
ingresoNeto money,
becas money default 0,
constraint pk_Ingresos primary key(cicCod, curCod, curSec)
)
go
create table factIngCursoAlumno
(
alucod char(8) references dimAlumno,
cursec char(2), ciccod char(6), curcod char(5),
alucurCosto float, alucurefe float,
alucurPF float,
constraint pk_facIC primary key(alucod, cursec, ciccod, curcod),
constraint fk_ingresos_curso
foreign key(cursec, ciccod, curcod) references factIngresos(cursec, ciccod, curcod)
)
go
sql sql-server foreign-keys
Help please, I'm always getting this message:
There are no primary or candidate keys in the referenced table 'factIngresosCurso' that match the referencing column list in the foreign key 'fk_ingresos_curso'.
My tables:
create table factIngresos
(
cicCod char(6),
curcod char(5) references dimCurso,
cursec char(2),
codSec char(1) references dimSeccion,
tiempoid int references dimTiempo,
codHor int references dimHorario,
proCodUno char(5) references dimPersonal,
vacantes int,
inscritos int,
ingresoProyectado money,
ingresoNeto money,
becas money default 0,
constraint pk_Ingresos primary key(cicCod, curCod, curSec)
)
go
create table factIngCursoAlumno
(
alucod char(8) references dimAlumno,
cursec char(2), ciccod char(6), curcod char(5),
alucurCosto float, alucurefe float,
alucurPF float,
constraint pk_facIC primary key(alucod, cursec, ciccod, curcod),
constraint fk_ingresos_curso
foreign key(cursec, ciccod, curcod) references factIngresos(cursec, ciccod, curcod)
)
go
sql sql-server foreign-keys
sql sql-server foreign-keys
edited Nov 11 at 19:21
marc_s
568k12810991249
568k12810991249
asked Nov 11 at 14:48
Angelo L Girard R
11
11
1
Your foreign key is referencingfactIngresosCurso
, which is not defined in the question. Hence there is not enough information.
– Gordon Linoff
Nov 11 at 14:51
Possible duplicate of There are no primary or candidate keys in the referenced table that match the referencing column list in the foreign key
– philipxy
Nov 11 at 19:28
This is a faq. Please always google many clear, concise & specific versions/phrasings of your question/problem/goal with & without your particular strings/names & read many answers. Add relevant keywords you discover to your searches. If you don't find an answer then post, using 1 variant search as title & keywords for tags. See the downvote arrow mouseover text. When you do have a non-duplicate code question to post please read & act on Minimal, Complete, and Verifiable example.
– philipxy
Nov 11 at 19:29
add a comment |
1
Your foreign key is referencingfactIngresosCurso
, which is not defined in the question. Hence there is not enough information.
– Gordon Linoff
Nov 11 at 14:51
Possible duplicate of There are no primary or candidate keys in the referenced table that match the referencing column list in the foreign key
– philipxy
Nov 11 at 19:28
This is a faq. Please always google many clear, concise & specific versions/phrasings of your question/problem/goal with & without your particular strings/names & read many answers. Add relevant keywords you discover to your searches. If you don't find an answer then post, using 1 variant search as title & keywords for tags. See the downvote arrow mouseover text. When you do have a non-duplicate code question to post please read & act on Minimal, Complete, and Verifiable example.
– philipxy
Nov 11 at 19:29
1
1
Your foreign key is referencing
factIngresosCurso
, which is not defined in the question. Hence there is not enough information.– Gordon Linoff
Nov 11 at 14:51
Your foreign key is referencing
factIngresosCurso
, which is not defined in the question. Hence there is not enough information.– Gordon Linoff
Nov 11 at 14:51
Possible duplicate of There are no primary or candidate keys in the referenced table that match the referencing column list in the foreign key
– philipxy
Nov 11 at 19:28
Possible duplicate of There are no primary or candidate keys in the referenced table that match the referencing column list in the foreign key
– philipxy
Nov 11 at 19:28
This is a faq. Please always google many clear, concise & specific versions/phrasings of your question/problem/goal with & without your particular strings/names & read many answers. Add relevant keywords you discover to your searches. If you don't find an answer then post, using 1 variant search as title & keywords for tags. See the downvote arrow mouseover text. When you do have a non-duplicate code question to post please read & act on Minimal, Complete, and Verifiable example.
– philipxy
Nov 11 at 19:29
This is a faq. Please always google many clear, concise & specific versions/phrasings of your question/problem/goal with & without your particular strings/names & read many answers. Add relevant keywords you discover to your searches. If you don't find an answer then post, using 1 variant search as title & keywords for tags. See the downvote arrow mouseover text. When you do have a non-duplicate code question to post please read & act on Minimal, Complete, and Verifiable example.
– philipxy
Nov 11 at 19:29
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
The primary key in factIngresos
is
cicCod, curCod, curSec
Yet in your other table, you reference it using these columns and sequence:
foreign key(cursec, ciccod, curcod)
As you can see, just guessing from the names of the columns, the ordering is not the same as in the primary key specification.
You need to ensure that the column and their ordering (!!) is identical - so my guess is, you would need to use this foreign key configuration instead:
constraint fk_ingresos_curso
foreign key(ciccod, curcod, cursec) references factIngresos(ciccod, curcod, cursec)
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
The primary key in factIngresos
is
cicCod, curCod, curSec
Yet in your other table, you reference it using these columns and sequence:
foreign key(cursec, ciccod, curcod)
As you can see, just guessing from the names of the columns, the ordering is not the same as in the primary key specification.
You need to ensure that the column and their ordering (!!) is identical - so my guess is, you would need to use this foreign key configuration instead:
constraint fk_ingresos_curso
foreign key(ciccod, curcod, cursec) references factIngresos(ciccod, curcod, cursec)
add a comment |
up vote
0
down vote
The primary key in factIngresos
is
cicCod, curCod, curSec
Yet in your other table, you reference it using these columns and sequence:
foreign key(cursec, ciccod, curcod)
As you can see, just guessing from the names of the columns, the ordering is not the same as in the primary key specification.
You need to ensure that the column and their ordering (!!) is identical - so my guess is, you would need to use this foreign key configuration instead:
constraint fk_ingresos_curso
foreign key(ciccod, curcod, cursec) references factIngresos(ciccod, curcod, cursec)
add a comment |
up vote
0
down vote
up vote
0
down vote
The primary key in factIngresos
is
cicCod, curCod, curSec
Yet in your other table, you reference it using these columns and sequence:
foreign key(cursec, ciccod, curcod)
As you can see, just guessing from the names of the columns, the ordering is not the same as in the primary key specification.
You need to ensure that the column and their ordering (!!) is identical - so my guess is, you would need to use this foreign key configuration instead:
constraint fk_ingresos_curso
foreign key(ciccod, curcod, cursec) references factIngresos(ciccod, curcod, cursec)
The primary key in factIngresos
is
cicCod, curCod, curSec
Yet in your other table, you reference it using these columns and sequence:
foreign key(cursec, ciccod, curcod)
As you can see, just guessing from the names of the columns, the ordering is not the same as in the primary key specification.
You need to ensure that the column and their ordering (!!) is identical - so my guess is, you would need to use this foreign key configuration instead:
constraint fk_ingresos_curso
foreign key(ciccod, curcod, cursec) references factIngresos(ciccod, curcod, cursec)
answered Nov 11 at 19:24
marc_s
568k12810991249
568k12810991249
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53249862%2fthere-are-no-primary-or-candidate-keys-in-the-referenced-table-factingresoscurs%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Your foreign key is referencing
factIngresosCurso
, which is not defined in the question. Hence there is not enough information.– Gordon Linoff
Nov 11 at 14:51
Possible duplicate of There are no primary or candidate keys in the referenced table that match the referencing column list in the foreign key
– philipxy
Nov 11 at 19:28
This is a faq. Please always google many clear, concise & specific versions/phrasings of your question/problem/goal with & without your particular strings/names & read many answers. Add relevant keywords you discover to your searches. If you don't find an answer then post, using 1 variant search as title & keywords for tags. See the downvote arrow mouseover text. When you do have a non-duplicate code question to post please read & act on Minimal, Complete, and Verifiable example.
– philipxy
Nov 11 at 19:29