w32tm /monitor
Microsoft AX 2012, X++, C#, SQL server, SSRS, Java, JavaFX, Oracle, PL/SQL, Delphi - codes examples, step-by-step tutorials, experiences.
Monday, April 6, 2020
Thursday, April 2, 2020
SQL SERVER - How to align string length to fixed size
With left() function is problem because ending spaces are lost. The solution is little trick with space() function.
select top 1 left( itemid, 25 ) + 'x' from inventitemprice
where
itemid = 'S-144-700-1006'
select top 1 left( itemid + space(100), 25 ) + 'x' from inventitemprice
where
itemid = 'S-144-700-1006'
Output: --------------------------
S-144-700-1006x
(1 row(s) affected)
--------------------------
S-144-700-1006 x
(1 row(s) affected)
Subscribe to:
Posts (Atom)