Properties

Owner: dbo 
Type: SQL scalar function 
Encrypted:  
Creation Date: 04/26/2006 
Modification Date: 04/26/2006 
Description: Scalar function returning the text representation of the Status column in the Document table. 

Creation options

QUOTED_IDENTIFIER:  
ANSI_NULLS:  

Parameters

Name Direction DataType Length Default Description
  @RETURN_VALUE  RETURN  nvarchar  16     
  @Status  INPUT  tinyint    Input parameter for the scalar function ufnGetDocumentStatusText. Enter a valid integer. 
Total: 2 parameter(s)

SQL

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE FUNCTION [dbo].[ufnGetDocumentStatusText](@Status [tinyint])
RETURNS [nvarchar](16)
AS
-- Returns the sales order status text representation for the status value.
BEGIN
    DECLARE @ret [nvarchar](16);

    SET @ret =
        CASE @Status
            WHEN 1 THEN N'Pending approval'
            WHEN 2 THEN N'Approved'
            WHEN 3 THEN N'Obsolete'
            ELSE N'** Invalid **'
        END;
    
    RETURN @ret
END;

GO
SET QUOTED_IDENTIFIER OFF
GO

GO
SET ANSI_NULLS OFF
GO

See Also

List of functions