1
When I add a request to the table TB_PEDIDOS
,
TB_PEDIDOS:
ID_PEDIDO, DATA_PEDIDO, ID_CLIENTE
I also need to add order details to another table:
TB_DETALHES_PEDIDOS:
ID_PEDIDO, ID_PRODUTO, QUANTIDADE, PRECO
Example:
Produto1 QTD:2 PRECO:5
Produto2 QTD:1 PRECO:2
Produto3 QTD:8 PRECO:3
Add the details with a loop, or is there another way to do this?
The database is SQL SERVER.
please improve the issue !!!
– user6026
see if you can understand now..
– Gerson
@Gerson, your question is a little confusing, but from what I understand you want to know if there is any way to insert data into 2 tables in the same
insert
, to add the order and items into a singleinsert
? Is that it? Something like ainsert
incascade
?– Fernando Leal
you are using some Framework ?
– Marco Souza