Link to home
Start Free TrialLog in
Avatar of webressurs
webressursFlag for Norway

asked on

Howto select articles with ParentId = NULL?

I have a stored procedure (see below) that take out all articles based on @ParentId. It works good, but some articles has ParentId = NULL in the database. When @ParentID = Null or nothing, it dont return the articles with parentId = NULL. What is wrong, how can I get the articles with ParentId = NULL?

ALTER PROCEDURE [dbo].[spGetContentsForTreeview]
(
    @ParentId int = null
)
AS

SELECT Id, [Name]  FROM tblContent  WHERE ParentId=@ParentId
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial