dbo.ufnLeadingZeros
Documentation | AdventureWorks |
Schema | dbo |
Name | ufnLeadingZeros |
Module | Sales |
Scalar function used by the Sales.Customer table to help set the account number.
Input/Output
Mode | Name | Data type | Description | |
---|---|---|---|---|
1 | OUT | Returns | varchar(8) | |
2 | IN | Value | int | Input parameter for the scalar function ufnLeadingZeros. Enter a valid integer. |
Input parameter for the scalar function ufnLeadingZeros. Enter a valid integer. |
Used by
Name |
---|
dbo.ufnLeadingZeros
|
Script
CREATE FUNCTION [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; |
Exported: 2019-02-04 23:13, Last imported: 2018-03-07 11:56