I have SQL Server Express 2008. How can I set 开发者_运维百科a table's relations in it?
Just like with any other database:
ALTER TABLE [tablename]
ADD CONSTRAINT [foreign_key_name]
FOREIGN KEY [local_column]
REFERENCES [foreign_table] ([foreign_column])
ON UPDATE RESTRICT
ON DELETE RESTRICT;
SQL Server Management Studio gives you a graphical UI to do the same thing through a click-and-point interface, but internally, it executes queries like these.
You could run the ALTER TABLE statements necessary to add the foreign key relationships between tables either via:
- SQLCMD
- Management Studio
- 2008 Express download
- 2005 Express download
You need to install SQL Server Management Studio or run the SQL to create the FKs yourself.
精彩评论