Use SubString function to trim the values.

select 
vrs.Name0 as [Machine Name] ,
SUBSTRING(vru.Unique_User_Name0, CHARINDEX('\', vru.Unique_User_Name0) + 1, 
LEN(vru.Unique_User_Name0)) AS [User Name],
vru.Full_User_Name0 as [Full Name]
 from v_UsersPrimaryMachines upm
left join v_R_User vru on upm.UserResourceID = vru.ResourceID
left join v_R_System vrs on upm.MachineID = vrs.ResourceID
where vru.Name0 IS NOT NULL
order by vru.Name0

Eswar Koneti

www.eskonr.com
From: [email protected]
To: [email protected]
Subject: [mssms] RE: OT: SQL Trim
Date: Mon, 7 Oct 2013 18:31:18 +0000








Because I didn't think of that. :-(
 
 
 
 






John Marcum

Sr. Desktop Architect
Bradley Arant Boult Cummings LLP






 


From: [email protected] [mailto:[email protected]]
On Behalf Of Daniel Ratliff

Sent: Monday, October 07, 2013 1:27 PM

To: [email protected]

Subject: [mssms] RE: OT: SQL Trim


 

Why not cross reference to the user_name0 column? It’s just the username and 
nothing else.

 

Daniel Ratliff

 


From:
[email protected]
[mailto:[email protected]]
On Behalf Of Marcum, John

Sent: Monday, October 07, 2013 2:21 PM

To: SMS List ([email protected])

Subject: [mssms] OT: SQL Trim


 

I always struggle with this… How to trim the domain\ off of of the user name 
here?
 
 
select 

vrs.Name0
as [Machine Name] ,
vru.Unique_User_Name0
as [User Name],
vru.cn0
as [Full Name]
 
from v_UsersPrimaryMachines upm

left
join v_R_User vru on upm.UserResourceID
= vru.ResourceID 

left
join v_R_System vrs on upm.MachineID
= vrs.ResourceID 

where vru.Name0
IS NOT 
NULL
order
by vru.Name0 

 
 
 
 
 
 
 









John Marcum

Sr. Desktop Architect
Bradley Arant Boult Cummings LLP









 

 





Confidentiality Notice: This e-mail is from a law firm and may be protected by 
the attorney-client or work product privileges. If you have received this 
message in error, please notify the sender by replying to this e-mail and then 
delete it from your computer.
 



The information transmitted is intended only for the person or entity to which 
it is addressed

and may contain CONFIDENTIAL material. If you receive this material/information 
in error,

please contact the sender and delete or destroy the material/information.









Confidentiality Notice: This e-mail is from a law firm and may be protected by 
the attorney-client or work product privileges. If you have received this 
message in error, please notify the sender by replying to this e-mail and then 
delete it from your computer.






Confidentiality Notice: This e-mail is from a law firm and may be protected by 
the attorney-client or work product privileges. If you have received this 
message in error, please notify the sender by replying to this e-mail and then 
delete it from your computer.





                                          

Reply via email to