• david.c.holley (5/20/2010)


    SELECT REPLACE(SUSER_NAME(), HOST_NAME() + '\','') as userId

    I need to pull out the user name from the fully qualified name ([domain name]/). The statement above isn't working as it fails to add the backslash to the host name.

    What am I missing?

    The host_name will not be found in the suser_name function. You are looking for the string that matches host_name + \ inside the string of suser_name.

    Are you trying to replace the user id with the host_name or with an empty string?

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events