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
--
Giorgio Rancati
[Office Access MVP]
Jose Perdigao said:
Giorgio,
Is it possibel to get the domain and login with two diferrent functions?
Thanks
Jose