Can someone help me find the mistake in this create?

Asked

Viewed 110 times

-3

CREATE TABLE PedidoProduto + ProdutoPedido ( 
Quantidade numeric(50),
IDproduto int,
IDpedido int,
FOREIGN KEY(IDproduto) REFERENCES Produto (IDproduto),
FOREIGN KEY(IDpedido) REFERENCES Pedido (IDpedido)
);

In error gives this:

Message 102, Level 15, Status 1, Line 63
Incorrect syntax next to '+'.

The table PedidoProduto is associative.

  • 3

    You are wanting to create two tables at the same time?

  • 3

    the mistake is: Sintaxe incorreta no + !

1 answer

3

The error of this CREATE is that there is no + option where you are putting (as SQL Server itself is showing you).

If you are trying to create both tables at the same time create 2 separate CREATE in your script, creating first always the table that will have the primary keys and then the table that will have the FK, ie that will depend on the data of another.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.