Reputation: 47743
I'm trying to use the Relationships dialog in SQL 2008 to add a new foreign key to a table field. When I go to add one, I am not able to change and specify the Foreign Key Base table or any others in the "Tables and Columns Specification" area...they're all greyed out for those values and uneditable and I"m not sure why.
Upvotes: 3
Views: 2668
Reputation: 1
Easier is to add a database diagram, add the desired tables, then drag/drop the relations from and to the intended fields. In this way a logic name of the relation will also be created.
Upvotes: 0
Reputation: 22187
Well, this is too visual for me.
ALTER TABLE dbo.MyTable
ADD myNewColumn int NOT NULL
go
ALTER TABLE dbo.MyTable
ADD CONSTRAINT FK1_MyTable FOREIGN KEY(myNewColum) REFERENCES dbo.myRefTable(ID)
go
If you try this "the thing" may come-up with some kind of an error that describes where the problem is.
Upvotes: 1
Reputation: 432271
Have you clicked the ellipsis button to get the wee dialog box?
The section "Tables and Columns Specification" area has a wee button where you choose the tables and columns: you can't enter stuff directly.
Upvotes: 11