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
 Transact-SQL (2000)
 Insertion with single sql statment

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-04-20 : 09:47:28
syed writes "Hi Every body..
I wanna ask that can we insert data into multiple
tables using a single sql statment which would insert data into multiple tables in data base.

Thanks.

Regards
Syed shah"

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2004-04-20 : 09:58:12
No, You can create a strored procedure which can accept your input parameters and perform multiple inserts in one call, but it will require multiple insert statements.
Go to Top of Page

cas_o
Posting Yak Master

154 Posts

Posted - 2004-04-20 : 09:58:49
You need an INSERT trigger on the first table. When you insert a record too it it will execute the TSQL you put in the trigger.

CREATE TRIGGER <trigger_name> ON <table_name> FOR INSERT AS ..TSQL....

;-]
Go to Top of Page
   

- Advertisement -