May 14, 2009 at 10:43 pm
-- ================================================================
-- Author:
-- Create date: <14 may 2009>
-- Usage :
-- Description:
-- =================================================================
ALTER FUNCTION dbo.getEscaltions
(
/*
@parameter1 int = 5,
@parameter2 datatype
*/
@empid bigint
)
RETURNS @escalated TABLE (nestedesc varchar(max),finalesc varchar(max))/* @table_variable TABLE (column1 datatype, column2 datatype) */
AS
BEGIN
Declare @escStat varchar(50)
Declare @escRa varchar(50)
Declare @esclast varchar(50)
set @escStat='Y'
set @escRa=''
while (@escStat='Y')
BEGIN
set @esclast=@empid
SELECT @escStat=Other1,@empid=Cast(Other2 as bigint) FROM Employee_Master WHERE (Emp_ID = @empid)
set @escRa=@escRa+Cast(@empid as varchar(50))+','
END
INSERT INTO @escalated select @escRa,@esclast
/* INSERT INTO @table_variable
SELECT ... FROM ... */
RETURN
END
May 14, 2009 at 10:48 pm
Is there a question here? I see code but no explanation as to what you are trying to accomplish or what error message(s) you may be receiving.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply