Yeah, it could probably be that. I have no time right now to check it 
but as soon as I do it I'll let you know.
Thanks.

Julio Saucedo escribió:
> Hola Jose,
>
> I think that the problem is in your data, maybe you have some record 
> with a value in the field that you
> want to be the FK, having a value that is not in the foreign table. I 
> think that is what means the message
> "Foreign key reference target does not exist". You could first identify 
> the record(s) and set a null value or
> some other value that effectively is in the foreign table, in the field 
> for the FK.
>
> Best regards.
>
> Julio Saucedo.
>
>   
>> I think just like you, I don't find the problem arrgggg It'll probably 
>> be some other moron thing I've missed as always xD
>> Thanks
>>
>> Nico Callewaert escribió:
>>   
>>     
>>> Hi Jose,
>>>
>>> I copied everything in a little SQL script and I have no problem to run it 
>>> (except for the trigger, the generator TBFIBRAOPTICA_IDFO_GEN is missing).  
>>> But for the rest, I can create the foreign key without any problem.  *The 
>>> syntax is correct.
>>> *
>>> Regards, Nico
>>>
>>> -----Oorspronkelijk bericht-----
>>> Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Jose Perez
>>> Verzonden: dinsdag 27 november 2007 10:45
>>> Aan: For users and developers of the Firebird .NET providers
>>> Onderwerp: Re: [Firebird-net-provider] Problem witch foreign key
>>>
>>> I'm using EMS SQL studio nad here is what the sql statement he does to 
>>> create the tables:
>>>
>>> *TBVIAL*
>>>
>>> CREATE TABLE TBVIAL (
>>>   IDUO VARCHAR(50) CHARACTER SET WIN1251 NOT NULL COLLATE WIN1251,
>>>   LONGITUD VARCHAR(20) CHARACTER SET WIN1251 COLLATE WIN1251,
>>>   DESBROCE VARCHAR(20) CHARACTER SET WIN1251 COLLATE WIN1251,
>>>   EXCAVACIONROCA VARCHAR(20) CHARACTER SET WIN1251 COLLATE WIN1251,
>>>   EXCAVACIONTIERRA VARCHAR(20) CHARACTER SET WIN1251 COLLATE WIN1251,
>>>   TERRAPLENADO VARCHAR(20) CHARACTER SET WIN1251 COLLATE WIN1251,
>>>   ZAHORRA VARCHAR(20) CHARACTER SET WIN1251 COLLATE WIN1251,
>>>   CUNETATIERRA VARCHAR(20) CHARACTER SET WIN1251 COLLATE WIN1251,
>>>   CUNETAREVESTIDA VARCHAR(20),
>>>   SALVACUNETA VARCHAR(20) CHARACTER SET WIN1251 COLLATE WIN1251);
>>>
>>>
>>> ALTER TABLE TBVIAL ADD PRIMARY KEY (IDUO);
>>>
>>> *TBFIBRAOPTICA*
>>>
>>> CREATE TABLE TBFIBRAOPTICA (
>>>   IDFO INTEGER NOT NULL,
>>>   CIRCUITOFO VARCHAR(20) CHARACTER SET WIN1251 COLLATE WIN1251,
>>>   TIPOFO VARCHAR(50) CHARACTER SET WIN1251 COLLATE WIN1251,
>>>   LONGITUD INTEGER,
>>>   IDUO VARCHAR(50) CHARACTER SET WIN1251 DEFAULT '' NOT NULL COLLATE 
>>> WIN1251);
>>>
>>>
>>> ALTER TABLE TBFIBRAOPTICA ADD PRIMARY KEY (IDFO);
>>>
>>>
>>> SET TERM ^ ;
>>>
>>> CREATE TRIGGER BI_TBFIBRAOPTICA_IDFO FOR TBFIBRAOPTICA
>>> ACTIVE BEFORE INSERT
>>> POSITION 0
>>> AS
>>> BEGIN
>>>   IF (NEW.IDFO IS NULL) THEN
>>>       NEW.IDFO = GEN_ID(TBFIBRAOPTICA_IDFO_GEN, 1);
>>> END^
>>>
>>> SET TERM ; ^
>>>
>>> Then I'm trying to make de foreign key, something like:
>>>
>>> ALTER TABLE TBFIBRAOPTICA ADD CONSTRAINT FK_TBFIBRAOPTICA FOREIGN KEY 
>>> (IDUO) REFERENCES TBVIAL(IDUO) ON DELETE CASCADE ON UPDATE CASCADE;
>>>
>>> and then comes the error.
>>>
>>> Thanks in advance!
>>>
>>> Nico Callewaert escribió:
>>>   
>>>     
>>>       
>>>> Hi Jose,
>>>>
>>>> Can you mail the complete SQL statemtn for the table creation ?
>>>>
>>>> Thanks, Nico
>>>>
>>>> -----Oorspronkelijk bericht-----
>>>> Van: [EMAIL PROTECTED]
>>>> [mailto:[EMAIL PROTECTED] Namens Jose
>>>> Perez
>>>> Verzonden: dinsdag 27 november 2007 10:15
>>>> Aan: firebird-net-provider@lists.sourceforge.net
>>>> Onderwerp: [Firebird-net-provider] Problem witch foreign key
>>>>
>>>> Hi there. I'm a very beginner with Firebird, and the fist time posting 
>>>> on the list, so .. hi there again to you all.
>>>> I have a problem i can't resolve. I have two tables:
>>>>
>>>> TBFO
>>>> IDFO (integer autoincrement)
>>>> Circuito (VarChar(50))
>>>> Tipo (VarChar(50))
>>>> Longitud (integer)
>>>> idUO (VarChar(50))
>>>>
>>>> TBVIAL
>>>> tbVial
>>>> idUO (VarChar(50))
>>>> ...
>>>> ...
>>>> ...
>>>> ...
>>>>
>>>> And I'm tryin to make the foreign key idUO in tfFO, but it says to me :
>>>> Error!!
>>>> Violation of FOREIGN KEY constraint ""
>>>> Violation of FOREIGN KEY constraint "INTEG_83" on table "TBVIAL"
>>>> Foreign key reference target does not exist.
>>>>
>>>> Anyone knows why is this happening??
>>>> Thanks in advance.
>>>>
>>>> ------------------------------------------------------------------------
>>>> -
>>>> This SF.net email is sponsored by: Microsoft
>>>> Defy all challenges. Microsoft(R) Visual Studio 2005.
>>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>>>> _______________________________________________
>>>> Firebird-net-provider mailing list
>>>> Firebird-net-provider@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
>>>>
>>>>
>>>>
>>>>
>>>> -------------------------------------------------------------------------
>>>> This SF.net email is sponsored by: Microsoft
>>>> Defy all challenges. Microsoft(R) Visual Studio 2005.
>>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>>>> _______________________________________________
>>>> Firebird-net-provider mailing list
>>>> Firebird-net-provider@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
>>>>
>>>>   
>>>>     
>>>>       
>>>>         
>>> -------------------------------------------------------------------------
>>> This SF.net email is sponsored by: Microsoft
>>> Defy all challenges. Microsoft(R) Visual Studio 2005.
>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>>> _______________________________________________
>>> Firebird-net-provider mailing list
>>> Firebird-net-provider@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
>>>
>>>
>>>
>>>
>>> -------------------------------------------------------------------------
>>> This SF.net email is sponsored by: Microsoft
>>> Defy all challenges. Microsoft(R) Visual Studio 2005.
>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>>> _______________________________________________
>>> Firebird-net-provider mailing list
>>> Firebird-net-provider@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
>>>
>>>   
>>>     
>>>       
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Microsoft
>> Defy all challenges. Microsoft(R) Visual Studio 2005.
>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> _______________________________________________
>> Firebird-net-provider mailing list
>> Firebird-net-provider@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
>>
>>   
>>     
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Firebird-net-provider mailing list
> Firebird-net-provider@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
>
>   


-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to