| 
	
 | 
 Posted by Erland Sommarskog on 11/10/05 10:31 
laurenq uantrell (laurenquantrell@hotmail.com) writes: 
> I know I can do: 
>  
> DECLARE @UserNameWithDomain nvarchar(100) 
> SELECT @UserNameWithDomain = SYSTEM_USER 
>  
> DECLARE @UserNameNoDomain nvarchar(100) 
> SELECT @UserNameNoDomain = 
> SUBSTRING(@UserNameWithDomain,CHARINDEX('\',@UserNameWithDomain)+1,100) 
>  
> I'm hoping for something more aesthetic. 
 
I don't know if it's more esthetic, but parsename() is an alternative. 
 
 
--  
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se 
 
Books Online for SQL Server 2005 at 
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
 
  
Navigation:
[Reply to this message] 
 |