need procedure for add the books counting.
example
total books =50;
now i need to take one book 1;
now it reduce from the total -1=49;
if i return the book the value must be add to the total as 50;
procedure in sql server2008
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Iftikar HussainPosted Aug 18, 2013, 3:30 AM
Try like this
CREATE PROCEDURE usp_UpdateBookDetails
(
@BookId int,
@Type varchar(20)
)
AS
IF @Type='Issue'
BEGIN
UPDATE BookTable SET NoOfBook=NoOfBook-1 WHERE BookId=@BookId
END
ELSE
IF @Type='Return'
BEGIN
UPDATE BookTable SET NoOfBook=NoOfBook+1 WHERE BookId=@BookId
END
Regards,
Iftikar