My number needs to be 8 digits long, however If its less than 8 digits long I need to add trailing zeros to the it.
- Example: 1234
- Desired result: 12340000
I tried this at first:
DECLARE @YourNumber VARCHAR(8)=1234567;
SELECT DISTINCT
LEFT('00000000'+CAST(ISNULL(@YourNumber,0) AS VARCHAR),8)
However the result is: 00000000
If what you are asking for is actually what you want then try this: