CREATE  PROCEDURE [dbo].[sp_getMenuElements]
AS
BEGIN
 	 select id,page_name,(select count(*) FROM tTreeview WHERE parentid=sc.id) childnodecount,
	           logical_name, 
			   aspxPagePath
			   FROM tTreeview sc where parentid is NULL
			ORDER BY position;
END