So, basically, he's going to have to do more than one update,
regardless of how/where he does it, right?  I see the point of doing
it in a procedure (and agree with it), but it's still 2 updates,
nevertheless.

On Nov 4, 11:42 am, "Al Longobardi" <[EMAIL PROTECTED]> wrote:
> 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
> (
>   [EMAIL PROTECTED] varchar(20),
>   [EMAIL PROTECTED] varchar(20),
>   [EMAIL PROTECTED] int,
>   [EMAIL PROTECTED] 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?

Reply via email to