Difference between revisions of "Dbo.ufnLeadingZeros (function)"

From dbscript Online Help
Jump to: navigation, search
Line 5: Line 5:
 
| '''function
 
| '''function
 
| dbo.ufnLeadingZeros
 
| dbo.ufnLeadingZeros
 +
|- valign="top"
 +
| '''Description
 +
| Scalar function used by the Sales.Customer table to help set the account number.
 
|-
 
|-
 
|}
 
|}
Line 24: Line 27:
 
END;
 
END;
 
</pre>
 
</pre>
 +
 +
 +
 
== automatically generated ==
 
== automatically generated ==
  

Revision as of 22:56, 28 December 2009

wikibot

function dbo.ufnLeadingZeros
Description Scalar function used by the Sales.Customer table to help set the account number.
CREATE FUNCTION [dbo].[ufnLeadingZeros](
    @Value int
) 
RETURNS varchar(8) 
WITH SCHEMABINDING 
AS 
BEGIN
    DECLARE @ReturnValue varchar(8);

    SET @ReturnValue = CONVERT(varchar(8), @Value);
    SET @ReturnValue = REPLICATE('0', 8 - DATALENGTH(@ReturnValue)) + @ReturnValue;

    RETURN (@ReturnValue);
END;


automatically generated

function dbo.ufnLeadingZeros
Description Scalar function used by the Sales.Customer table to help set the account number.

CREATE FUNCTION [dbo].[ufnLeadingZeros](
    @Value int
) 
RETURNS varchar(8) 
WITH SCHEMABINDING 
AS 
BEGIN
    DECLARE @ReturnValue varchar(8);

    SET @ReturnValue = CONVERT(varchar(8), @Value);
    SET @ReturnValue = REPLICATE('0', 8 - DATALENGTH(@ReturnValue)) + @ReturnValue;

    RETURN (@ReturnValue);
END;