Hello!Wonder if anyone can spot whats wrong here, it errors on the line that calls the same stored procedure.Here is the create procedure code...set ANSI_NULLS ONset QUOTED_IDENTIFIER ONGO-- =============================================-- Author: <Author,,Name>-- Create date: <Create Date,,>-- Description: <Description,,>-- =============================================ALTER PROCEDURE [dbo].[exigeSP_ListCategoriesUnderCategory] -- Add the parameters for the stored procedure here @i_parent_category_id bigintASBEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; -- Insert statements for procedure hereDECLARE @NodeList varchar(max)DECLARE @category_id varchar(max)SELECT @category_id = Min(i_category_id) FROM t_categories WHERE i_parent_category_id = @i_parent_category_idIF @NodeList IS NOT NULL BEGIN SET @NodeList = @NodeList + ',' ENDELSE BEGIN SET @NodeList = '' ENDWHILE @category_id IS NOT NULL BEGIN SET @NodeList = @NodeList + @category_id SELECT @category_id = Min(i_category_id) FROM t_categories WHERE i_parent_category_id = @i_parent_category_id AND i_category_id > @category_id SET @NodeList = @NodeList + (exigeSP_ListCategoriesUnderCategory @category_id) IF @category_id IS NOT NULL BEGIN SET @NodeList = @NodeList + ',' END ENDSELECT @NodeListEND
Error...Msg 102, Level 15, State 1, Procedure exigeSP_ListCategoriesUnderCategory, Line 34Incorrect syntax near '@category_id'.
The reason for this SP is to create a list of category ID's underneath a certain category, and all of its sub categories.Any ideas?Thanks,Lee