Msg 207, Level 16, State 1, Line 8 Invalid column name 'MMMMM'. (1 row(s) affected)This is my stored procedure, and the 'MMMMM' is what I passing in as the second parameter.
ALTER PROCEDURE [dbo].[AppointmentsSelectByTutorsAndStudentID] ( @TutorIDs varchar(500), @StudentID char(5) ) AS BEGIN SET NOCOUNT ON; DECLARE @SQL varchar(600) SET @SQL = 'SELECT AppointmentID, TutorID, Description FROM [dbo].[Appointment] WHERE TutorID IN (' + @TutorIDs + ') OR AppointmentID IN (SELECT AppointmentID FROM StudentAppointments WHERE StudentID = ' + @StudentID + ')' EXEC(@SQL) ENDHere is the window when it runs
USE [StudAthl] GO DECLARE @return_value int EXEC @return_value = [dbo].[AppointmentsSelectByTutorsAndStudentID] @TutorIDs = N'10101, 30303', @StudentID = N'MMMMM' SELECT 'Return Value' = @return_value GO