SQL Server 2000 – TSQL

I posted a while ago about a client of mine that has a custom built system with SQL Server 2000 on the back-end. Well, I was working on it today and thought I might post a little TSQL code here for your viewing pleasure…

CREATE PROC stpDropDownEmployees_MGR (@FirstRowText nvarchar(50) = ‘—ALL ACCOUNTS—‘ )
AS
SELECT 1, ‘-1’ AS [VALUE], @FirstRowText AS [TEXT]
UNION ALL
SELECT 2, EmployeeID as [VALUE],
CASE WHEN EMP_Terminated = 1 THEN EMP_Lastname + ‘, ‘ + EMP_Firstname + ‘ *’
ELSE EMP_Lastname + ‘, ‘ + EMP_Firstname
END as [TEXT]
FROM EMPLOYEES
WHERE EMP_Terminated=0 AND EmployeeID NOT IN(2,5)
ORDER BY 1, 3
GO

, , , , , , , , ,

No comments yet.

Leave a Reply