English 中文(简体)
Cannot Specify Foreign Key Tables When Adding New Foreign Keys
原标题:

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.

最佳回答

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.

问题回答

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.





相关问题
Performance impact of indexed view in MS SQL Server 2008

Does anyone have experience with using indexed view in MS SQL Server 2008? I am trying to find out how does indexed view affect performance of insert / update statements, that are adding / updating ...

Lock Escalation - What s happening here?

While altering a table (removing a column) in SQL Server 2008, I clicked the Generate Change Script button and I noticed that the change script it generated drops the column, says "go" and then runs ...

Round to nearest 5 in SQL Server

I have a Money column in my SQL Server 2008 table. In my below query how can I round it to nearest 5$ select FineAmount from tickets Thanks

热门标签