July 12, 2011 at 9:45 pm
Hi All,
I have a simple SP to perform update operation . Once the update operation is complete, i want to print Message as " No. of rows updated in name1 table is __(count from previous update)__" ...
Can anyone help me on this one??
ALTER PROCEDURE [dbo].[Userupdate]
@OldName varchar(256),
@NewName varchar(256)
AS
Begin
update master set name1=@Newname where cstatus='Y' and name1=@Oldname
update master set name2=@Newname where cstatus='Y' and name2=@Oldname
End
Result should be :
No. of rows updated in name1 table is 2.
No. of rows updated in name2 table is 0.
July 13, 2011 at 12:46 am
Something like this?
ALTER PROCEDURE [dbo].[Userupdate]
@OldName varchar(256),
@NewName varchar(256)
AS
Begin
declare @rows varchar(38),
@msg varchar(2000)
update master set name1=@Newname where cstatus='Y' and name1=@Oldname
set @rows = @@rowcount
set @msg='No. of rows updated in name1 table is ' +@rows
print @msg
update master set name2=@Newname where cstatus='Y' and name2=@Oldname
set @rows = @@rowcount
set @msg='No. of rows updated in name2 table is ' +@rows
print @msg
End
July 13, 2011 at 12:52 am
i think in your case this will work.
Raiserror('message %s',0,1,@rowcount)with no wait.
it will give u the message at the time of execution it self
for more details follow the like
July 13, 2011 at 7:01 pm
Thank you All...
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply