Champ-434386
SSC Veteran
Points: 249
More actions
May 11, 2007 at 6:18 am
#178504
Hi All,
I am not so much aware of writing SP in sql , can i write a sp which can update two or more tables , if yes then please give me an example.
Thanks in advance
Anders Pedersen
SSChampion
Points: 11410
May 11, 2007 at 6:35 am
#705788
Yes. Just use two seperate update statements
create procedure usp_UpdateTwoTables
as
begin
update table1
set Column1 = 'a'
update table2
set Column2 = 'b'
end
Gordon Pollokoff
SSCommitted
Points: 1930
May 11, 2007 at 6:38 am
#705790
create procedure usp_UpdateTables
@value varchar(50)
BEGIN
UPDATE table1
SET col1 = @value
UPDATE table2
SET colA = @value
END
"Wile E. is my reality, Bugs Bunny is my goal" - Chuck Jones
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply