You're not getting any results because your database is trying to retrieve data for a UserID of
%, which I imagine doesnt exist as a UserID. Using the
LIKE keyword with wild card characters would be like this
sql
SELECT StudentID, StudentFName, StudentLName, StudentSecurityLevel, StudentGrade FROM StudentInfo WHERE StudentID LIKE '%' + 15
That would retrieve all information for all users who's UserID starts with
15 and ends with any number of digits. If you're wanting to retrieve user information for a specific user, say UserID 15, then dont use the
LIKE keyword, use the equals sign, like
sql
SELECT StudentID, StudentFName, StudentLName, StudentSecurityLevel, StudentGrade FROM StudentInfo WHERE StudentID = 15
You could also put this into a stored procedure where you pass an INT data type parameter like
sql
CREATE PROCEDURE uspGetStudentInfo @SDtudentID INT
AS
SELECT
StudentID,
StudentFName,
StudentLName,
StudentSecurityLevel,
StudentGrade
FROM
StudentInfo
WHERE
StudentID = @StudentID
Here is some more information on the
LIKE keyword and the wildcards characters that can be used with it.
Hope this answers your question?