Friday, March 30, 2012

Relationsships

Trying to stablish reatlionship between tables"
BioData and EventstHistory with a key called Enumber in
BioData and foreing key called also Enumber in
EventsHistory, i get this message:
'biodata' table saved successfully
'eventshistory' table
- Unable to create
relationship 'FK_eventshistory_biodata'.
ODBC error:
SQL Server]ALTER TABLE statement conflicted with COLUMN
FOREIGN KEY constraint 'FK_eventshistory_biodata'.
The conflict occurred in database 'hrMasterData',
table 'biodata',
column 'enumber'.Fredy,
Can you please pass us the ALTER TABLE script you executed and the structure
for the two tables?
--
Dinesh.
SQL Server FAQ at
http://www.tkdinesh.com
"FREDY COREA" <fredycorea@.hotmail.com> wrote in message
news:59fa01c37700$91828020$a601280a@.phx.gbl...
> Trying to stablish reatlionship between tables"
> BioData and EventstHistory with a key called Enumber in
> BioData and foreing key called also Enumber in
> EventsHistory, i get this message:
> 'biodata' table saved successfully
> 'eventshistory' table
> - Unable to create
> relationship 'FK_eventshistory_biodata'.
> ODBC error:
> SQL Server]ALTER TABLE statement conflicted with COLUMN
> FOREIGN KEY constraint 'FK_eventshistory_biodata'.
> The conflict occurred in database 'hrMasterData',
> table 'biodata',
> column 'enumber'.|||I did not crate any script, i did it from the table Design
Table option, is there any way to gather the script
generated?
>--Original Message--
>Fredy,
>Can you please pass us the ALTER TABLE script you
executed and the structure
>for the two tables?
>--
>Dinesh.
>SQL Server FAQ at
>http://www.tkdinesh.com
>"FREDY COREA" <fredycorea@.hotmail.com> wrote in message
>news:59fa01c37700$91828020$a601280a@.phx.gbl...
>> Trying to stablish reatlionship between tables"
>> BioData and EventstHistory with a key called Enumber in
>> BioData and foreing key called also Enumber in
>> EventsHistory, i get this message:
>> 'biodata' table saved successfully
>> 'eventshistory' table
>> - Unable to create
>> relationship 'FK_eventshistory_biodata'.
>> ODBC error:
>> SQL Server]ALTER TABLE statement conflicted with COLUMN
>> FOREIGN KEY constraint 'FK_eventshistory_biodata'.
>> The conflict occurred in database 'hrMasterData',
>> table 'biodata',
>> column 'enumber'.
>
>.
>|||Thanks, here its :
BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
BEGIN TRANSACTION
COMMIT
BEGIN TRANSACTION
ALTER TABLE dbo.eventshistory ADD CONSTRAINT
FK_eventshistory_biodata FOREIGN KEY
(
enumber
) REFERENCES dbo.biodata
(
enumber
)
GO
COMMIT
>--Original Message--
>Fredy,
>Yes.There is a button called 'save change script' , the
third one from left.
>--
>Dinesh.
>SQL Server FAQ at
>http://www.tkdinesh.com
>"FREDYCOREA" <fredycorea@.hotmail.com> wrote in message
>news:586701c37703$2f03c7d0$a501280a@.phx.gbl...
>> I did not crate any script, i did it from the table
Design
>> Table option, is there any way to gather the script
>> generated?
>>
>> >--Original Message--
>> >Fredy,
>> >
>> >Can you please pass us the ALTER TABLE script you
>> executed and the structure
>> >for the two tables?
>> >
>> >--
>> >Dinesh.
>> >SQL Server FAQ at
>> >http://www.tkdinesh.com
>> >
>> >"FREDY COREA" <fredycorea@.hotmail.com> wrote in message
>> >news:59fa01c37700$91828020$a601280a@.phx.gbl...
>> >> Trying to stablish reatlionship between tables"
>> >> BioData and EventstHistory with a key called Enumber
in
>> >> BioData and foreing key called also Enumber in
>> >> EventsHistory, i get this message:
>> >>
>> >> 'biodata' table saved successfully
>> >> 'eventshistory' table
>> >> - Unable to create
>> >> relationship 'FK_eventshistory_biodata'.
>> >> ODBC error:
>> >>
>> >> SQL Server]ALTER TABLE statement conflicted with
COLUMN
>> >> FOREIGN KEY constraint 'FK_eventshistory_biodata'.
>> >>
>> >> The conflict occurred in database 'hrMasterData',
>> >> table 'biodata',
>> >> column 'enumber'.
>> >
>> >
>> >.
>> >
>
>.
>|||Fredy,
The below script works fine.
CREATE TABLE biodata
(
enumber INT PRIMARY KEY
)
GO
CREATE TABLE eventshistory
(
enumber INT
)
GO
ALTER TABLE dbo.eventshistory ADD CONSTRAINT
FK_eventshistory_biodata FOREIGN KEY
(
enumber
) REFERENCES dbo.biodata
(
enumber
)
Dinesh.
SQL Server FAQ at
http://www.tkdinesh.com
"fredy" <fredycorea@.hotmail.com> wrote in message
news:5a7901c37706$1b5f85e0$a601280a@.phx.gbl...
> Thanks, here its :
> BEGIN TRANSACTION
> SET QUOTED_IDENTIFIER ON
> SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
> SET ARITHABORT ON
> SET NUMERIC_ROUNDABORT OFF
> SET CONCAT_NULL_YIELDS_NULL ON
> SET ANSI_NULLS ON
> SET ANSI_PADDING ON
> SET ANSI_WARNINGS ON
> COMMIT
> BEGIN TRANSACTION
> COMMIT
> BEGIN TRANSACTION
> ALTER TABLE dbo.eventshistory ADD CONSTRAINT
> FK_eventshistory_biodata FOREIGN KEY
> (
> enumber
> ) REFERENCES dbo.biodata
> (
> enumber
> )
> GO
> COMMIT
>
>
> >--Original Message--
> >Fredy,
> >
> >Yes.There is a button called 'save change script' , the
> third one from left.
> >
> >--
> >Dinesh.
> >SQL Server FAQ at
> >http://www.tkdinesh.com
> >
> >"FREDYCOREA" <fredycorea@.hotmail.com> wrote in message
> >news:586701c37703$2f03c7d0$a501280a@.phx.gbl...
> >> I did not crate any script, i did it from the table
> Design
> >> Table option, is there any way to gather the script
> >> generated?
> >>
> >>
> >> >--Original Message--
> >> >Fredy,
> >> >
> >> >Can you please pass us the ALTER TABLE script you
> >> executed and the structure
> >> >for the two tables?
> >> >
> >> >--
> >> >Dinesh.
> >> >SQL Server FAQ at
> >> >http://www.tkdinesh.com
> >> >
> >> >"FREDY COREA" <fredycorea@.hotmail.com> wrote in message
> >> >news:59fa01c37700$91828020$a601280a@.phx.gbl...
> >> >> Trying to stablish reatlionship between tables"
> >> >> BioData and EventstHistory with a key called Enumber
> in
> >> >> BioData and foreing key called also Enumber in
> >> >> EventsHistory, i get this message:
> >> >>
> >> >> 'biodata' table saved successfully
> >> >> 'eventshistory' table
> >> >> - Unable to create
> >> >> relationship 'FK_eventshistory_biodata'.
> >> >> ODBC error:
> >> >>
> >> >> SQL Server]ALTER TABLE statement conflicted with
> COLUMN
> >> >> FOREIGN KEY constraint 'FK_eventshistory_biodata'.
> >> >>
> >> >> The conflict occurred in database 'hrMasterData',
> >> >> table 'biodata',
> >> >> column 'enumber'.
> >> >
> >> >
> >> >.
> >> >
> >
> >
> >.
> >

No comments:

Post a Comment