Display name fixed number of character remaining fill with specific character
In the following example, I want to fill the name exactly 20 characters, if the character count is exceed 20 character remove remaining character and if the character is lesser than 20 character fill with blank space(left aligned).
Example
This will produce
But you can't able to see the blank space's so you should need to identify the space using [] or other way.
Example
SELECT convert(nvarchar(20),LEFT(CONVERT(NVARCHAR, 'Merbin Joe') + SPACE(20), 20)) Name
This will produce
Merbin Joe
But you can't able to see the blank space's so you should need to identify the space using [] or other way.
SELECT quotename(convert(nvarchar(20),LEFT(CONVERT(NVARCHAR, 'Merbin Joe') + SPACE(20), 20))) Name
Nhận xét
Đăng nhận xét