habib ullah

habib ullah

  • NA
  • 229
  • 14.1k

searching with different paramater

Apr 21 2018 6:33 AM
hello brother
i am searching in database i have passing the multiple paramater  
and all the paramater they are searching but the rollnumber is not working 
my code is below
ALTER PROCEDURE [School].[SurcheStudent]
(
@StudentID INT=null,
@ClassAdmitted_ID INT=null,
@Section int=null,
--@IsActive bit=null,
@StudentRegNo varchar(50)=null,
@StudentName varchar(50)=null,
@StudentFname varchar(50)=null,
@RollNo int=null
)
AS
BEGIN
--DECLARE @IsActive int
--if @IsActive=1
--Begin
SELECT ST.StudentID ,ST.StudentName,St.FatherName,St.FatherCNIC,St.StudentAddress,SCM.CurrentClass_ID,SCM.CurrentSection_ID,
SCM.RollNumber,
ST.Account_ID,
ST.StudentRegNo
FROM School.StudentInformation ST INNER JOIN School.StudentClassMapping SCM ON ST.StudentID=Scm.Student_ID
WHERE SCM.CurrentClass_ID=@ClassAdmitted_ID AND SCM.CurrentSection_ID=@Section
AND ST.StudentName LIKE '%'+ISNULL(@StudentName,St.StudentName)+'%'AND ST.FatherName LIKE '%'+ISNULL(@StudentFname,St.FatherName)+'%' AND RollNo=isnull(@RollNo,SCM.RollNumber)
AND ST.StudentID=ISNULL(@StudentID,St.StudentID) AND ST.StudentRegNo LIKE '%'+@StudentRegNo+'%' AND ST.IsActive=1
END
 

Answers (2)