Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Invalid Column Name error
Message
From
11/11/2010 10:36:15
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Environment versions
SQL Server:
SQL Server 2008
Miscellaneous
Thread ID:
01488773
Message ID:
01488819
Views:
26
It is funny how we sometimes resign ourselves to looking to someone else for help. That was so obvious one would think a programmer would spot it. Thanks for the help, that worked and I will see if there is any difference between them. I have them all working now.
Tim

>You're missing a closing ) in your code
>
>WHERE 
>		TutorID IN (SELECT Value from dbo.fnSplit(@TutorIDs, ',') -- here we need to add one more )
>
>
>I also don't like IN solution that much. I prefer using EXISTS operator.
>
>>>>Ah, well I didn't mean to. I just copy and pasted in and it worked. Thanks
>>>>Tim
>>>>
>>>You're welcome. I will be curious if you can compare 3 versions of the query: your original and 2 versions I posted and tell me the execution plans and percentage.
>>>
>>>Put all 3 queries (after a correction to your original) into one sql script and run them
>>>
>>>set nocount on
>>>set statistics io on
>>>set statistics time on
>>>query 1
>>>query 2
>>>query 3
>>>
>>>
>>>and post the results as well as percentage of execution time from the actual execution plan.
>>
>>
>>Hi Naomi,
>>
>>I doubt that would be useful as I only have test data plus this query pulls no more than a few records. I would be happy to do it however.
>>
>>Now I do have a problem with the query that uses the function. I have this error.
>>
>>Msg 156, Level 15, State 1, Procedure AppointmentsSelectByTutorsPlusStudentID, Line 19
>>Incorrect syntax near the keyword 'OR'.
>>
>>
>>With this SP
>>
>>CREATE PROCEDURE [dbo].[AppointmentsSelectByTutorsPlusStudentID]
>>(
>>	@TutorIDs varchar(500),
>>	@StudentID char(5)
>>)
>>AS
>>BEGIN
>>	SET NOCOUNT ON;
>>	
>>	SELECT 
>>		AppointmentID,
>>		TutorID,
>>		Description
>>	FROM [dbo].[Appointment]
>>	WHERE 
>>		TutorID IN (SELECT Value from dbo.fnSplit(@TutorIDs, ',') OR
>>		AppointmentID IN (SELECT AppointmentID FROM StudentAppointments WHERE StudentID = @StudentID) 
>>	
>>END
>>
>>Thanks
>>Tim
Timothy Bryan
Previous
Reply
Map
View

Click here to load this message in the networking platform