Wednesday, 20 September 2017

Right pad a string with variable number of spaces

SELECT 
    RIGHT(space(60) + cust_name, 60),
    RIGHT(space(60) + cust_address, 60)
OR (for trailing spaces)
SELECT
    LEFT(cust_name + space(60), 60),
    LEFT(cust_address + space(60), 60),

No comments:

Post a Comment

Note: only a member of this blog may post a comment.

Blog Archive