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

BEGIN
DECLARE @ret [nvarchar](15);
SET @ret = 
CASE @Status
WHEN 1 THEN 'In process'
WHEN 2 THEN 'Approved'
WHEN 3 THEN 'Backordered'
WHEN 4 THEN 'Rejected'
WHEN 5 THEN 'Shipped'
WHEN 6 THEN 'Cancelled'
ELSE '** Invalid **'
END;

RETURN @ret
END;
See Also

Related Objects

dbo Schema
AdventureWorks Database

 

 


© 2012 All Rights Reserved.

Send comments on this topic.