Solved

'user_name()' funtion  returns domain as well

Posted on 2003-11-21
3
303 Views
Last Modified: 2012-08-14
I have set of logins and users for a database who all inherit permissions from a Windows group.

When a user takes a record, a field called '[UName]' is populated.  I have set the default value of this field to the function  'user_name()' to get the value into the field.

I do not want any of the logins, database access permissions of their own as they automatically inherit from the Windows Group.  However if I take all db permissions away and rely on the group permissions, 'user_name()' returns 'mydomain/harry' instead of just 'harry'.

I would like to return just the username without the domain.  Is there another command that will do this for me or will I have to resort to string manipulation?

Wing
0
Comment
Question by:WingYip
3 Comments
 
LVL 3

Accepted Solution

by:
Joeharvey earned 50 total points
ID: 9796420
user_name() gets the information straight from the SYSUSERS table.  If the account is an NT authenticated account, it will always have the domain prefix on it.  You will need to modify the string yourself.

jm
0
 
LVL 34

Expert Comment

by:arbert
ID: 9797126
Also, take a look at User_Name() or system_user
0
 
LVL 1

Author Comment

by:WingYip
ID: 9798558
Thanks all

Wing
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now