Sure,
Write a stored procedure that does both updates there. If you need a
specific parameter for each update, no problem. Just add the 2 parameters in
the stored procedure. ie:
create procedure test_me
(
@FirstUpdateData varchar(20),
@SecondUpdateData varchar(20),
@Id1 int,
@Id2 int )
as
Begin
update table1
set Data1 = @FirstUpdateData
where Id = @Id1
update table2
set Data2 = @SecondUpdateData
Where id = @Id2
if @errors <> 0
Begin
RollBack;
End
Else
Begin
Commit
End
End
Hope this helps...
Al
On Tue, Nov 4, 2008 at 10:54 AM, Chuck <[EMAIL PROTECTED]> wrote:
>
> Are you wanting to restrict/reduce the amount of times you hit the
> database with statements, or you simply want to have one - and only
> one - SQL UPDATE statement update 'n' amount tables at the same time?
> More info is definitely needed.
>
> However, I don't believe you can have one Update statement update
> multiple tables at the same time, unless you concatenate multiple
> UPDATE statements together. I heard and read that doing sql
> concatenation is 'the work of the devil,' especially if you adding
> fields from objects such as textboxes. It would be sql injection
> prone.
>
> Give more info please.
>
> On Nov 3, 11:27 pm, BigJ <[EMAIL PROTECTED]> wrote:
> > Is it possible to do an update on multiple tables within 1 statement?