Re: SQL 2000: Inserting multiple rows into a single table
From: Uri Dimant (urid_at_iscar.co.il)
Date: 04/28/04
- Next message: Uri Dimant: "Re: How to access sql table field description in asp.net."
- Previous message: Aaron Bertrand [MVP]: "Re: How to access sql table field description in asp.net."
- In reply to: JB: "SQL 2000: Inserting multiple rows into a single table"
- Next in thread: Erland Sommarskog: "Re: SQL 2000: Inserting multiple rows into a single table"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 28 Apr 2004 08:35:02 +0200
JB
I am not sure understand you. Why do you need variables for your columns?
First thought
CREATE PROC spInsert_Order
@OrderID int,
......
.......
AS
BEGIN TRAN
INSERT INTO Orders VALUES (@OrderID,...,...,...)
INSERT INTO Orders_Details VALUES ((@OrderID...........)
COMMIT
Second thought
You can create trigger for INSERT on Orders table. When you perform INSERT
statement the trigger is fired and insert appropriate data into
Orders_Details table
"JB" <JBSchuler@tampabay.rr.com> wrote in message
news:972c667c.0404271523.12c4ae22@posting.google.com...
> To anyone that is able to help....
>
> What I am trying to do is this. I have two tables (Orders, and
> OrderDetails), and my question is on the order details. I would like
> to set up a stored procedure that essentially inserts in the orders
> table the mail order, and then insert multiple orderdetails within the
> same transaction. I also need to do this via SQL 2000. Right now i
> have "x" amount of variables for all columns in my orders tables, and
> all Columns in my Order Details table. I.e. @OColumn1, @OColumn2,
> @OColumn3, @ODColumn1, @ODColumn2, etc... I would like to create a
> stored procedure to insert into Orders, and have that call another
> stored procedure to insert all the Order details associated with that
> order. The only way I can think of doing it is for the program to pass
> me a string of data per column for order details, and parse the string
> via T-SQL. I would like to get away from the String format, and go
> with something else. If possible I would like the application to
> submit a single value per variable multiple times. If I do it this way
> though it will be running the entire SP again, and again. Any
> suggestions on the best way to solve this would be greatly
> appreciated. If anyone can come up with a better way feel free. My
> only requirement is that it be done in SQL.
>
> Thank you
- Next message: Uri Dimant: "Re: How to access sql table field description in asp.net."
- Previous message: Aaron Bertrand [MVP]: "Re: How to access sql table field description in asp.net."
- In reply to: JB: "SQL 2000: Inserting multiple rows into a single table"
- Next in thread: Erland Sommarskog: "Re: SQL 2000: Inserting multiple rows into a single table"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|