help with a modification Table

  • Hello am new in this site and in sql server 2000, and i want some help about  a table modification, i import some tables from paradox using DTS, and i want to make a relationship betwen them, just to make some querys, and show some information with active reports..and visual basic 6.0 ...ok..i try to assign a primary key to some tables... and then related them...some let do it but other ones don't  i have a warning that says.. "unable to create index fk_Faoty2".. but it only happens with FACT02 and FAOTy02.... that are headers and details of invoices..

     

    please... help..i'll appreciate it to much.

  • This post actually should have gone in another section, this one is for suggestions about the web site. 

    The problem is most likely due to data in the foreign key table that doesn't have a match in the primary key table.

    Table A with primary key col1 has the following data in col1
    ABC
    DEF
    GHI
    Table B has a col1 with the following data in col1
    ABC
    DEF
    IGH
     
    If I try to create a foreign key on table B, it will fail because there is no row in A that matchs IGH.

    Hope this helps!

     

     

     

    Aunt Kathi Data Platform MVP
    Author of Expert T-SQL Window Functions
    Simple-Talk Editor

  • Kathi's probably right.  Note that you don't need to create foreign key constraints on tables to join them together.  Your reporting tool may make use of existing ref integrity constraints between tables to assist with some kind of graphical joining but that doesn't mean that you cannot just tell the reporting tool how the tables are linked manually.  This way you may be able to get some reports out and bypass the bad data.

    Make sure though that you investigate what data you could be missing.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply