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
 General SQL Server Forums
 New to SQL Server Programming
 Update Multiple Tables Using a Single Query

Author  Topic 

chiman

21 Posts

Posted - 2007-11-06 : 14:07:06
Hi,
I am using SQl server 2005.
want to update rows in 2 tables,which have a relation on Id field.

Some thing like
Update tblA a , tblB b
Set a.UpdatedDt=getdate(),b.Updateddt=getdate()
where a.Id=b.Id and a.Name='xyz'

can anyone out there help me?


Thanks
Renu

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-11-06 : 14:13:24
This can't be done.
You have to do two update statements.



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

arorarahul.0688
Posting Yak Master

125 Posts

Posted - 2007-11-07 : 02:45:48
try with
After trigger for updation on nay table and update seond table in the body of the trigger
for first table

Rahul Arora
MCA 07 Batch
NCCE Israna, Panipat
HRY, INDIA

######################
IMPOSSIBLE = I+M+POSSIBLE
Go to Top of Page
   

- Advertisement -