Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Invalid Column Name error
Message
 
 
À
11/11/2010 10:16:18
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Versions des environnements
SQL Server:
SQL Server 2008
Divers
Thread ID:
01488773
Message ID:
01488818
Vues:
26
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
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform