simple make a table,records save of Book keeping.view of Table id,name,status,booksname. when this table entry before we check count of Id with the help of where condition status=true.
select count(*) from TableName where id=@id and
insert into TableName values(id,BooksName) where status=true
create proc testing
(
@id int=0,
@books varchar(max)=null,
@nameofStudent varchar(max)=null,
@bookid varchar(max)=null
)
as
declare @tempCount int;
select @tempCount=COUNT(status) from tableName where ID=@id
if(@tempCount<4)
begin
insert into Tablename values(@id,@bookid,@nameofStudent,@books)
end
else
begin
print'this student allready have four books'
end
return
for any query hit to reply..
happy to Help ☺