LPAD in T-SQL and Crystal Report Formula
I am sure there should have some neater ways to do this but if all you need are just working version, here it goes.
T-SQL
REPLICATE('0', 8 - LEN(LTRIM(STR(YourTableField)))) + LTRIM(STR(YourTableField))
Crystal Report Formula
StringVar Message := "";
StringVar Num := {YourCrystalReportTable.Field};
Num := Trim (Num);
NumberVar Counter := 8 - Length(Num) ;
While (Counter > 0) do
(
Message := Message & "0";
Counter := Counter - 1;
);
Message := Message & Num
T-SQL
REPLICATE('0', 8 - LEN(LTRIM(STR(YourTableField)))) + LTRIM(STR(YourTableField))
Crystal Report Formula
StringVar Message := "";
StringVar Num := {YourCrystalReportTable.Field};
Num := Trim (Num);
NumberVar Counter := 8 - Length(Num) ;
While (Counter > 0) do
(
Message := Message & "0";
Counter := Counter - 1;
);
Message := Message & Num
Comments