this is my procedure i want to limit the data inserting on give time like i want to insert only 12 member in a give time if the user is reach the number of value which i want to get is show the message else insert the value.
my procedure is doing the first part its tack the number of value which i want if the number of value is reach the number 12 than its show me the message but when i m change the time its also show me the same magess plz check what i m doing worng and if u have any solution about this plz provide me
create procedure SP_insert_test
@name varchar(20),@emailid varchar(20),
@trainer_name varchar(50),@training_date varchar(50),@training_time varchar(50),@gymname varchar(50)
,@success int out
as
begin
if(select count(id) from Add_Booking_Fitness_Training where training_time=@training_time)>11
print N'Number of Booking Is Complete for this time and date plz book other time';
else
insert into Add_Booking_Fitness_Training(memeber_name,member_emailid,trainer_name,training_date,training_time,gymname)
values(@name,@emailid,@trainer_name,@training_date,@training_time,@gymname)
SELECT SCOPE_IDENTITY()
set @success=1;
end
begin
set @success=0;
end

Ravi PatelRank #439 · 5.7K reputationPosted Apr 26, 2018, 3:13 AM EDT
Shahriar NikkhahRank #248 · 10.1K reputationPosted Apr 26, 2018, 5:17 PM EDT
Arun EddyRank #4,600 · 335 reputationPosted May 9, 2018, 12:10 AM EDT
Shahriar NikkhahRank #248 · 10.1K reputationPosted May 10, 2018, 3:02 AM EDT