Re: User Name

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



When you are using SQL Server Authentication, the Windows XP login is never
transmitter over the wire and remains totally unknown to the SQL-Server.
This remains true even if both are located on the same local machine,
needless to say when they are not even part of the same domain as in your
case.

So unless you choose to transmit it yourself to the SQL-Server, you cannot
do what you have asked for in your original post.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF


"Jose Perdigao" <perdijc@xxxxxxxxxxx> wrote in message
news:O77P1D7hGHA.4864@xxxxxxxxxxxxxxxxxxxxxxx
Good Morning Graham,



In FE. I don't have problem, I can get the current user name (login) by
VBA.

My problem is to create a function in SQL Server that returns the login
and use it as criteria in store procedures.



Thanks,

jose perdigao



"Graham R Seach" <gseach@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:OCaSAY5hGHA.4144@xxxxxxxxxxxxxxxxxxxxxxx
Jose,

What you need to do is get the domain username. To do that, you get it
directly from the domain.

This might be a tad overkill, but you might find a use for it:
http://www.pacificdb.com.au/MVP/Code/UserInfoClass.htm

A simpler way can be found at:
http://www.mvps.org/access/api/api0008.htm

Regards,
Graham R Seach
Microsoft Access MVP
Canberra, Australia
---------------------------

"Jose Perdigao" <perdijc@xxxxxxxxxxx> wrote in message
news:%23eb%23LYOhGHA.4708@xxxxxxxxxxxxxxxxxxxxxxx
Good afternoon
I using the following function to get the login from Windows XP

ALTER FUNCTION dbo.iLogin ()
RETURNS varchar(30)
AS
BEGIN
/* Sql Server autentication mode */
IF CharIndex('\',system_user)=0
RETURN system_user
/* Windows Autentication mode */
RETURN SUBSTRING(system_user,CharIndex('\',system_user)+1,30)
ENDALTER FUNCTION dbo.iLogin ()
RETURNS varchar(30)
AS
BEGIN
/* Sql Server autentication mode */
IF CharIndex('\',system_user)=0
RETURN system_user
/* Windows Autentication mode */
RETURN SUBSTRING(system_user,CharIndex('\',system_user)+1,30)
END

I connect to sql server with - Use windows NT INtegrated security. The
function return the login of win XP, it works fine.

From remote connection, I can't connect using Windows NT INtegrated
security and then I must connect with SQL Server Authentication.
When I run the function, return the SQL Sever login and not Windows XP
login.

Question.

Is it possible create a funtion using Sql Server Autehntication
connection and return Windows XP login?

Any Suggestions?

Thanks,
José Perdigão







.



Relevant Pages

  • Re: Granting permission to a database - need help
    ... Windows authentication, and not use an application login, as then ... Links for SQL Server Books Online: ... USE Driver Access ...
    (microsoft.public.sqlserver.programming)
  • Re: ODBC worked until Server reboot defaulted to windows authentic
    ... I got the exact spelling of the windows login with the case and I rebooted ... The odbc source is set up in windows and that connects on the test. ... The SQL Server Mgmt studio connects also but only as Windows authentication. ...
    (microsoft.public.sqlserver.setup)
  • Re: login 101..
    ... On Windows 2003, SQL Server 2005 can enforce the Windows password complexity ... Windows authentication - SQL Server uses a special protocol to ask ... user is in the list of allowed logins, ...
    (microsoft.public.sqlserver.security)
  • Re: Granting permission to a database - need help
    ... folder and it would have the database connection info. ... Windows authentication, and not use an application login, as then ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ...
    (microsoft.public.sqlserver.programming)
  • RE: How to create a trusted connection
    ... You need to grant access for the Windows login by referring to the books ... is set to use Windows authentication to be able to do trusted connection. ... There are two modes of authentication in SQL Server: ...
    (microsoft.public.sqlserver.security)