I am having trouble understanding why the RIGHT function is not working for me. I tried to fit as much output in here, my apologies if it is confusing to read.
DECLARE @Nbr VARCHAR(27)
SELECT @Nbr = xmz.nbr
FROM @xml_temp AS xmz
SELECT @Nbr AS 'Number',
LEFT(@Nbr, 4) AS 'LEFT',
LEN(@Nbr) AS 'Length',
SUBSTRING(@Nbr, 10, 4) AS 'SUBSTRING',
RIGHT(@Nbr, 4) AS 'RIGHT'
Number: 154448887859999
LEFT: 1544
Length: 15
SUBSTRING: 9999
RIGHT: EMPTY
spaces perhaps, LEN doesn't count spaces while DATALENGTH does
can you run
SELECT DATALENGTH(@Nbr) AS 'Length',
RIGHT(RTRIM(@Nbr), 4) AS 'RIGHT'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With