Reputation: 1059
I have created a table having three colums GsID,ALlowance and amount
Begin if exists(select * from [dbo].[HRAllowances] where GdId=@GdId) begin
update [dbo].[HRAllowances] set
Amount=@Amount where GdId=@GdId end
end
this only works for one particular row..
i want to allow user to update amount for all rows
Upvotes: 1
Views: 305
Reputation: 103348
After seeing your comment, if you wish to update all Amount
fields for all records, remove your WHERE
clause as this is filtering records by ones where GdId=@GdId
:
UPDATE [dbo].[HRAllowances]
SET Amount=@Amount
Upvotes: 4
Reputation: 717
If you want to update all the rows than you have to remove where condition that is
where GdId=@GdId
from you query.
Like this :-
update [dbo].[HRAllowances] set Amount=@Amount
I hope it will works!!
Upvotes: 1