ALTER TABLE table1 ADD constraint fkname FOREIGN KEY (tid) REFERENCES table2(id)
sqlserver给表添加外键
原文:http://www.cnblogs.com/goodsunny/p/3516881.html