I write stored procedure for update.
create procedure sp_videos_updateviews (@videoid varchar(50),@ret int output)
as
set @ret = update videos set [views]=[views]+1
where videoid = @videoid
if(@ret>1)
begin
set @ret=1
end
else
begin
set @ret=0
end
but it is giving error like this
Incorrect syntax near the keyword ‘update’.
Surya,
From what I gather you are looking to return from the proc a 1 or 0 depending on if any records were updated from your proc. I agree that @@ROWCOUNT is where you should go, try this code: