Difference between revisions of "Dbo.ufnLeadingZeros (function)"
(New page: == wikibot == {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- | '''function | dbo.ufnLeadingZeros |- |} <pre> CREATE FUNCTION [dbo].[ufnLeadingZeros]( ...) |
|||
Line 9: | Line 9: | ||
<pre> | <pre> | ||
+ | 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; | ||
+ | </pre> | ||
+ | |||
+ | == automatically generated == | ||
+ | |||
+ | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
+ | |- | ||
+ | | '''function | ||
+ | | dbo.ufnLeadingZeros | ||
+ | |- | ||
+ | |||
+ | | '''Description | ||
+ | | Scalar function used by the Sales.Customer table to help set the account number. | ||
+ | |- | ||
+ | |||
+ | |} | ||
+ | |||
+ | <pre> | ||
+ | |||
CREATE FUNCTION [dbo].[ufnLeadingZeros]( | CREATE FUNCTION [dbo].[ufnLeadingZeros]( | ||
@Value int | @Value int |
Revision as of 00:28, 27 November 2009
wikibot
function | dbo.ufnLeadingZeros |
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;