Function: [AdventureWorks2016CTP3].[dbo].[ufnGetPurchaseOrderStatusText_native]

CollapseAll image

Collapse image Function properties


 Name   Value 
 Schema   [dbo] 
 Owner   [dbo] 
 Creation date   23.10.2015 
 Type   Scalar 
 Is schema bound 
 Is deterministic   
 Encrypted   
 Implementation type   Transact SQL 
 ID   1716201164 

Collapse image Creation options


Name Value
QUOTED_IDENTIFIER ON
ANSI_NULLS ON

Collapse image Parameters


Name  Description DataType  Max length  ReadOnly
@Status   tinyint 1  

Collapse image Recordset returned


Name  Datatype  Max length 
@Return nvarchar 15

Collapse image SQL


SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO

CREATE FUNCTION dbo.ufnGetPurchaseOrderStatusText_native (@Status tinyint)
RETURNS nvarchar(15) 
WITH NATIVE_COMPILATION, SCHEMABINDING
AS
BEGIN ATOMIC WITH (TRANSACTION ISOLATION LEVEL = SNAPSHOT, LANGUAGE = N'English')

    IF @Status=1 RETURN 'Pending'
    IF @Status=2 RETURN 'Approved'
    IF @Status=3 RETURN 'Rejected'
    IF @Status=4 RETURN 'Complete'
    
    RETURN '** Invalid **'

END
GO

Collapse image See also


List of functions