This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
dev:sql:functions:lpad [2010/07/08 17:57] els |
dev:sql:functions:lpad [2016/06/28 22:38] (current) |
||
---|---|---|---|
Line 4: | Line 4: | ||
===== Description ===== | ===== Description ===== | ||
Pad the string on the left with spaces or the named character. If the string is already padded, as happens with a CHARACTER datatype, the string must first be trimmed using the TRIM function. | Pad the string on the left with spaces or the named character. If the string is already padded, as happens with a CHARACTER datatype, the string must first be trimmed using the TRIM function. | ||
+ | |||
+ | This function returns a STRING datatype. | ||
+ | |||
===== Syntax ===== | ===== Syntax ===== | ||
Line 23: | Line 26: | ||
==== Example: Column ==== | ==== Example: Column ==== | ||
- | //In this example, the name must first be trimmed and since it is already padded with spaces.// | + | In this example, the name must first be trimmed and since it is already padded with spaces. |
+ | |||
+ | <code> | ||
+ | > SELECT $lpad(trim(name), 40, '.') nme FROM individuals; | ||
- | <code SQL> | ||
NME | NME | ||
---------------------------------------- | ---------------------------------------- | ||
Line 36: | Line 41: | ||
.........................KATHLEEN TUCKER | .........................KATHLEEN TUCKER | ||
</code> | </code> | ||
+ | ====== Additional Resources ====== | ||
+ | |||
+ | See also: | ||
+ | {{page>dev:sql:functions:see_also_string&nofooter&noeditbtn&noheader}} | ||
+ | |||
{{page>:bottom_add&nofooter&noeditbtn}} | {{page>:bottom_add&nofooter&noeditbtn}} |