I was wondering if there is a way to select the remaining characters from the varchar field if the field length is greater than 5.
For example:
ID_Num
99984
99923GF
99100EFK
99341LM
99145RL4C
What I am trying to get:
ID_Num
GF
EFK
LM
RL4C
STUFF
is great for things like this:
SELECT STUFF(ID_Num,1,5,'')
FROM YourTable
WHERE LEN(ID_Num) > 5;
STUFF
is used to "replace" characters within a string. In this case, it replaces the next 5 characters from position 1 (which is the start of the string), with the string ''
; thus removing them.
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