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.
+1
A:
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.
gbn
2009-12-01 20:08:17
yes, we have PKs defined on all our tables.
CoffeeAddict
2009-12-01 20:09:53
A:
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.
Damir Sudarevic
2009-12-01 20:25:26
I like visual. Why code when you can do things like this to tables visually.
CoffeeAddict
2009-12-02 03:23:46
SQL is already painful enough. I love staying away from it as much as possible...
CoffeeAddict
2009-12-02 03:24:16