Hi Jose ,
you can modify your function
----
CREATE FUNCTION dbo.iLogin (@Type bit)
RETURNS varchar(30)
AS
-- @Type 0 returns Domain
-- 1 returns user
BEGIN
/* Sql Server autentication mode */
IF CharIndex('\',system_user)=0
RETURN system_user
/* Windows Autentication mode */
--Domain
IF @Type=0
RETURN LEFT(system_user,CharIndex('\',system_user)-1)
--User
RETURN SUBSTRING(system_user,CharIndex('\',system_user)+1,30)
END
----
-- Get domain name
Select dbo.iLogin(0)
-- Get Login name
Select dbo.iLogin(1)
bye

Signature
Giorgio Rancati
[Office Access MVP]
> Giorgio,
> Is it possibel to get the domain and login with two diferrent functions?
> Thanks
> Jose
Jose Perdigao - 26 Jan 2006 15:16 GMT
His is a really what I want.
Works perfectly,
Thanks Giorgio
jose
> Hi Jose ,
>
[quoted text clipped - 34 lines]
> > Thanks
> > Jose