SELECT * FROM (SELECT NULL AS DepartmentID, '' as Name) AllDepartments UNION SELECT DepartmentID, Name FROM HumanResources.Department ORDER BY Name
Use OR in the WHERE clause as follows to use te passed parameter -
ELECT DepartmentID, Name FROM HumanResources.Department WHERE (DepartmentID IS NULL) OR (DepartmentID = @DepartmentID)
No comments:
Post a Comment