RE: T-SQL Experts - Can this SP be recoded to work as a UDF
Try this, it's not all that much differnet from what you already have:Create FUNCTION dbo.udf_GetEMpsBYManager(@empid char(6))RETURNS @table_variable TABLE (employeeid char(6), sn varchar(15), givenname varchar(25), mail varchar(50) )ASBEGINDeclare @temp Table (employeeid char(6))Declare @rows IntInsert Into @tempSelect Distinctemployeeid FromdirectoryWherehigmanagerempid = @empidWhile @rows > 0BeginInsert Into @tempSelect DistinctD.employeeidFromdirectory D Left Join@temp T OnD.higmanagerempid = T.employeeidWhereT.employeeid Is NullSet @rows […]
2004-03-19