Quantcast
Channel: Getting started with SQL Server forum
Viewing all articles
Browse latest Browse all 9243

how to insert single row in Order table and multiple rows in OrderDetails table via stored procedure.

$
0
0

Thank you For Help

LetMe ExplainBetter.

I have four tables Named Customers_0, Orders_0, Order_Details  and  Products  ThatTheir CharacteristicsAreAsFollows :

Customers_0

Column Name

Data Type

Allow Null

Cust_id

int

Unchecked

Name

nvarchar(30)

Unchecked

Family

nvarchar(30)

Unchecked

Phone

nvarchar(20)

Unchecked

Address

nvarchar(50)

Unchecked

Cust_id is PK and identity (1,1)                    

Orders_0

Column Name

Data Type

Allow Null

Ord_id

int

Unchecked

Ord_date

nchar(20)

Unchecked

Cust_id

int

Checked

Ord_id is PK and identity(1,1) ; Cust_id is FK .

There are1-to-M RelationshipBetweenCustomers_0and Orders_0 .

Order_Details

Column Name

Data Type

Allow Null

Prod_id

int

Unchecked

Prod_name

nvarchar(50)

Unchecked

Quantity

numeric(18, 0)

Unchecked

Fee

money

Unchecked

Total_Amount

money

Unchecked

Unit

nchar(20)

Unchecked

Ord_id

int

Checked

 

Prod_idis PK and Not Identity ; Ord_id is FK .

There are1-to-M RelationshipBetweenOrders_0 andOrder_Details .

I want insert single row in Order table and multiple rows in OrderDetails table via stored procedure.

Please hlpe me!

Please Give Me A Stored Procedure And A Algorithm Of This Sample.


Viewing all articles
Browse latest Browse all 9243

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>