hi how to set stored procedure while inserting values to query like for example
RegisterNo,Semister and RoomNo these are columns
in one room no 32 register no s can save.if it reaches to 32 and we cant give same column name for that.?
can any one suggest me?and i want to display message in aspx that 101 room number exceeded 32 student so type other room number to save.?
Loading

SenthilkumarPosted Mar 17, 2012, 11:25 AM
When you have the required input then you can get the count.
DECLARE @CheckCount INT
SELECT @CheckCount = COUNT(RegisterNo) FROM RegistrationTable WHERE condition comes here...
IF (@ CheckCount > 32)
BEGIN
RETURN 'Exceeded'
END
ELSE
BEGIN
INSERT INTO RegistrationTab...
RETURN 'Success'
END
This is good way to approach... Other wise you can write separate stored procedure or query to check before call the SP.