[thelist] SQL: ALTER TABLE syntax help

Michael Buffington mike at price.com
Tue Apr 17 18:54:13 CDT 2001


I'm trying to figure out how to add a one-to-many relationship between two
tables using T-SQL.

Using the Northwind sample database, I deleted the relationship in a SQL
Diagram, and now I'd like to see if I can't add it back using T-SQL (I know
I can very easily add it back using SQL Diagrams).

Here's what I've been thinking of using, but I know I'm off:

use Northwind
ALTER TABLE orders ADD
order_id INT IDENTITY
REFERENCES [Order Details](Order_id)

Of course, I get an error stating that the Orders table can only have one
identity column.

Any ideas?

Michael Buffington
http://www.michaelbuffington.com
mike at stompzine.com
cell. (714) 404-8616
home. (949) 457-2247




More information about the thelist mailing list