Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Spread data to multiple tables

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-05-15 : 09:34:44
Ingvild writes "I have a web-page containging a form that transmits data to a (temporar) database table, and only one. I don't know any ASP or other script languages, so that's just the way it has to be for now. The problem is, that I would like this data to be spread to three other tables (e.g. Customers, Orders and Orderlines). I'm using SQL Server 2000 and Windows 2000."

YellowBug
Aged Yak Warrior

616 Posts

Posted - 2002-05-15 : 10:23:10
You can use a trigger to transmit the data.

CREATE TRIGGER tr_FirstTable_i ON t_FirstTable
FOR INSERT
AS
INSERT Customers
SELECT ColumnA, ColumnB FROM INSERTED
INSERT Orders
SELECT ColumnA, ColumnB FROM INSERTED
INSERT Orderlines
SELECT ColumnA, ColumnB FROM INSERTED
GO
Go to Top of Page

dsdeming

479 Posts

Posted - 2002-05-15 : 13:50:26
When you split the data up, just make sure that each table contains sufficient key data to be able to join it all back up again later ( CustomerID, OrderID, etc. ).

Go to Top of Page
   

- Advertisement -