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

From dbscript Online Help
Jump to: navigation, search
 
(5 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
|-
+
|- valign="top"
| '''function
+
| '''Function
 
| dbo.ufnLeadingZeros
 
| dbo.ufnLeadingZeros
|-
+
|- valign="top"
 +
| '''Description
 +
| Scalar function used by the Sales.Customer table to help set the account number.
 
|}
 
|}
  
 +
=== Source ===
 
<pre>
 
<pre>
 
CREATE FUNCTION [dbo].[ufnLeadingZeros](
 
CREATE FUNCTION [dbo].[ufnLeadingZeros](
Line 24: Line 27:
 
END;
 
END;
 
</pre>
 
</pre>
 +
  
 
== automatically generated ==
 
== automatically generated ==
Line 31: Line 35:
 
| '''function
 
| '''function
 
| dbo.ufnLeadingZeros
 
| dbo.ufnLeadingZeros
|-
+
|- valign="top"
 
 
 
| '''Description
 
| '''Description
 
| Scalar function used by the Sales.Customer table to help set the account number.
 
| Scalar function used by the Sales.Customer table to help set the account number.
 
|-
 
|-
 
 
|}
 
|}
  

Latest revision as of 22:59, 23 June 2010

wikibot[edit]

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

Source[edit]

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[edit]

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;