Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Megidolaon
Starting Member
2 Posts |
Posted - 2010-11-01 : 17:57:43
|
I'm trying to add a foreign key column to an existing table and I get a syntax error.To me it looks like the syntax is exactly the same as in the msdn example, can you tell me what the problem is?ALTER TABLE t_invoice ADD customer_id integer CONSTRAINT FK_customer_id FOREIGN KEY (customer_id) REFERENCES t_customer (customer_id) Thanks! |
|
Sachin.Nand
2937 Posts |
Posted - 2010-11-02 : 01:01:28
|
What is the error?Can you post it?I dont get any syntax errors with the below sample test query.create table a(id int primary key)create table b(id1 int)ALTER TABLE b ADD idtest integer CONSTRAINT FK_test_id FOREIGN KEY (id1) REFERENCES a (id)select * from aselect * from bdrop table bdrop table a PBUH |
|
|
|
|
|