I have a string in the following format 'DOMAIN\username'.
I wish to trim the domain and the backslash from the string. I cannont simply use RIGHT() as we have multiple domains of varying length.
What is the most portable way to do this?
Thank you.
I have a string in the following format 'DOMAIN\username'.
I wish to trim the domain and the backslash from the string. I cannont simply use RIGHT() as we have multiple domains of varying length.
What is the most portable way to do this?
Thank you.
Select Right('DOMAIN\UserName', Len('DOMAIN\UserName') - Charindex('\', 'DOMAIN\UserName'))
you can try:
select substring('DOMAIN\username', charindex('\' ,'DOMAIN\username')+1, len('DOMAIN\username'))