Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
cgoasduff
Starting Member
21 Posts |
Posted - 2009-03-13 : 12:14:18
|
| Hello,i am trying to to self-reference table (sql server) I am creating it through vusual studio. I get the error'tbl_department' table- Unable to create relationship 'FK_tbl_department_tbl_department'.ALTER TABLE statement conflicted with COLUMN FOREIGN KEY SAME TABLE constraint 'FK_tbl_department_tbl_department'. The conflict occurred in database 'IMS_DB', table 'tbl_department', column 'dpt_id'.any idea ? (this table has other FK but pointing to other tables - they work fine)ThanksChris |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-03-13 : 13:09:18
|
| what are you trying to do with fk? linking on one column to another? |
 |
|
|
cgoasduff
Starting Member
21 Posts |
Posted - 2009-03-13 : 15:19:08
|
| That's right,dpt_id is the primary key and dpt_parentID is foreign key referencing to dpt_id in the same table.In fact I am following this tutorial [ http://authors.aspalliance.com/joteke/treeviewarticle/article.aspx ] and my table as the same structure as the one in the tutorial ( names are different though! ) |
 |
|
|
cgoasduff
Starting Member
21 Posts |
Posted - 2009-03-16 : 12:22:11
|
| This is now fixed - I was trying to create this foreign key whilsthaving data in the table. I deleted the data then created my key then reentered the data. thank youChris |
 |
|
|
|
|
|