Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
cidr
Posting Yak Master
207 Posts |
Posted - 2009-04-29 : 09:28:08
|
| Hi there,I wonder if anyone knows how to return the username without returning the server part.For example, if I use (suser_sname()) or SYSTEM_USER. I get back Server/username. So in my case that's ACTCO/pwatson.I want to strip the ACTO/ part and have only pwatson. I've tried RTRIM and CHARINDEX etc, but can't find a way to strip the first 6 characters to resolve this.Hope someone can help. Thaks |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-04-29 : 09:36:49
|
As an approach:select replace('ACTCO/pwatson','ACTCO/','') orselect replace((select system_user),(@@servername+'/'),'')Webfred No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-04-30 : 04:09:53
|
| orselect substring(suser_sname(),charindex('/',suser_sname())+1,len(suser_sname()))MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|