SQL left-Padded

Source: Internet
Author: User

    1. Oracle
    2. The syntax format is as follows:
    3. Lpad (String, Padded_length, [pad_string])
    4. String
    5. Prepares the string to be filled;
    6. Padded_length
    7. The length of the string after padding, that is, the length of the string returned by the function, if the number is shorter than the length of the original string, the Lpad function will intercept the string as a left-to-right n character;
    8. Pad_string
    9. Padding string, is an optional argument, this string is to be pasted to the left of string, if this parameter is not written, the Lpad function will paste a space on the left side of the string.
      Source: > [SQL] View plaincopy
      1. Select Lpad (22,10,' 0 ') from dual;
      2. Results:
      3. 1 0000000022
Sqlserver:right function

Grammar    Right( string, length) RightThe syntax of a function has the following named arguments:
Part Description
String Necessary parameters. A string expression in which the rightmost character is returned. If string contains null, nullis returned.
Length The necessary parameters are Variant (Long). As a numeric expression that indicates how many characters you want to return. If 0, returns a 0-length string (""). If the number of characters is greater than or equal to string , the entire string is returned.
Example:

Right (Replicate (' 0 ',ten) +ltrim (parametric),ten)

    1. Oracle
    2. The syntax format is as follows:
    3. Lpad (String, Padded_length, [pad_string])
    4. String
    5. Prepares the string to be filled;
    6. Padded_length
    7. The length of the string after padding, that is, the length of the string returned by the function, if the number is shorter than the length of the original string, the Lpad function will intercept the string as a left-to-right n character;
    8. Pad_string
    9. Padding string, is an optional argument, this string is to be pasted to the left of string, if this parameter is not written, the Lpad function will paste a space on the left side of the string.
      Source: > [SQL] View plaincopy
      1. Select Lpad (22,10,' 0 ') from dual;
      2. Results:
      3. 1 0000000022
Sqlserver:right function

Grammar    Right( string, length) RightThe syntax of a function has the following named arguments:
Part Description
String Necessary parameters. A string expression in which the rightmost character is returned. If string contains null, nullis returned.
Length The necessary parameters are Variant (Long). As a numeric expression that indicates how many characters you want to return. If 0, returns a 0-length string (""). If the number of characters is greater than or equal to string , the entire string is returned.
Example:

Right (Replicate (' 0 ',ten) +ltrim (parametric),ten)

SQL left-Padded

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.