fn_rpad (Transact_SQL)

See also: fn_lpad

 


This scalar UDF pads a given string to the right with specified character. Similar to Oracle's RPAD function.
 

Syntax

 fn_rpad(@string_to_pad,@pad_char,@pad_to_len)

 

Arguments

@string_to_pad = NVARCHAR(MAX) , string that will be padded with @pad_char;

@pad_char = NVARCHAR(4000), char/string used to pad the input string.

@pad_to_len = BIGINT, the final length of the result string after padding

 

Return type

NVARCHAR(MAX)

Remarks

none

 

Permissions

Public

 

Dependencies

none

 

Examples

SELECT* FROM [Lib].[tsql].[fn_rpad]('mystring', '*',20)

mystring************

 

Other

none

Last edited Aug 20, 2012 at 1:54 PM by adudau, version 2

Comments

No comments yet.