INDENT
Updated: 30 April 2009
Use INDENT to place characters at the beginning of a string of text.
Syntax
SELECT [wctString].[wct].[INDENT] (
<@Text, nvarchar(max),>
,<@IndentChars, nvarchar(4000),>
,<@IndentLevels, int,>)
Arguments
@Text
the text to be indented. The @Text argument can be of data types that are implicitly convertible to nvarchar or ntext.
@IndentChars
the character or characters to be used for indenting. The @IndentChars argument can be of data types that are implicitly convertible to nvarchar or ntext.
@IndentLevels
the number of times that the @IndentChars is to be repeated at the beginning of @Text. The @IndentLevels argument can be an expression of types that are implicitly convertible to int.
Return Types
nvarchar(max)
Remarks
· The result of INDENT changes the width of the TEXT. To add characters to the beginning of @Text while still limiting the overall width, use the PADLEFT function.
· The @IndentChars are inserted after every CRLF in @Text.
Examples
select wct.INDENT('Now is the time for all' + wct.CRLF() + 'good men to come to the aid of their country'
,'>'
,5)
This produces the following result
-------------------------------------------------------------------------------
>>>>>Now is the time for all
>>>>>good men to come to the aid of their country
(1 row(s) affected)