AdventureWorks
dbo.ufnGetPurchaseOrderStatusText User Defined Function
Description
Scalar function returning the text representation of the Status column in the PurchaseOrderHeader table.
Properties
Creation Date08/01/2010 08:41
Encrypted
Ansi Nulls
Parameters
ParameterDirectionDescriptionData TypeSize
@StatusInInput parameter for the scalar function ufnGetPurchaseOrdertStatusText. Enter a valid integer.tinyint1
@RETURN_VALUEReturn Value nvarchar15
Procedure Source Code
CREATE FUNCTION [dbo].[ufnGetPurchaseOrderStatusText](@Status [tinyint])
RETURNS [nvarchar](15) 
AS 

BEGIN
DECLARE @ret [nvarchar](15);
SET @ret = 
CASE @Status
WHEN 1 THEN 'Pending'
WHEN 2 THEN 'Approved'
WHEN 3 THEN 'Rejected'
WHEN 4 THEN 'Complete'
ELSE '** Invalid **'
END;

RETURN @ret
END;
See Also

Related Objects

dbo Schema
AdventureWorks Database

 

 


© 2012 All Rights Reserved.

Send comments on this topic.