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









share|improve this question




















  • 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















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









share|improve this question




















  • 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













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









share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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














  • 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








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












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)





share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    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

























    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)





    share|improve this answer

























      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)





      share|improve this answer























        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)





        share|improve this answer












        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)






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 11 at 19:24









        marc_s

        568k12810991249




        568k12810991249






























            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Florida Star v. B. J. F.

            Danny Elfman

            Lugert, Oklahoma