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 2005 Forums
 Transact-SQL (2005)
 CAN I INSERT,DELETE,UPDATE2tables at the same time

Author  Topic 

mochi
Starting Member

2 Posts

Posted - 2008-04-25 : 15:58:25
i've read the transact-sql command,

i known that the select command use to retrieve many fields from many tables with one command

select * from table1,table2

yes,

but i ' ve not seen the way to add,delete or update those fields from those tables with one command...



Is it possible? why?

I don't have any idea , can u help me

I want to know the sql commands , if it's possible

thanks for reply,

mochi


tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-04-25 : 16:03:20
You can join tables together with SELECT, INSERT, UPDATE, and DELETE but INSERT/UPDATE/DELETE will only modify one table at a time.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

soorajtnpki
Posting Yak Master

231 Posts

Posted - 2008-04-26 : 01:59:31
hi
SQL Server 2008's new MERGE statement allows you to insert, update, or delete data based on certain join conditions in the same statement.

ok ,
thanks.
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2008-04-26 : 02:49:24
if the tables are joined in a view, and the view is updatable, you could do it indirectly with a single statement by having the update statement target the view.


elsasoft.org
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-04-26 : 07:28:43
With the new OUTPUT operator you can insert into two tables simultaneously.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -