Using @ in User or groups

  • Hi all,

    We have implemented a new naming scheme which uses @mssql for all SQL Server user accounts and groups.

    Ive just created a new SQL box and used the naming convention and cant log in.

    When i create add account from AD in Security. It changes the @Username to _Username.

    Does SQL by chance not allow @ in user names? Trying to find a info online but searchs are coming up short.

    Thanks

  • I would never start a username with a special character. I can't find anything off the bat either, but it just seems like a pointless convention. Why was this implemented? I believe usernames can only contain letters, numbers, and very few special characters. _ is one, @ is not.

    EDIT: User names CAN use the @ special character, but cannot start with it.

    Jared
    CE - Microsoft

  • Hi,

    Not sure why they implemented it, but yeah it don't work in SQL,

    Soon as i changed the group to MSSQLGroupName i was in and working.

    Lesson learned!

    Thanks for the reply 🙂

    S

  • looks like a GUI data input tweak;

    if you go straight to TSQL, you cannot create a ulogin or user that starts with @

    you can create either for a login which contains the @ symbol though:

    --fails at syntax check:

    CREATE USER @BATMAN WITHOUT LOGIN

    --works just fine.

    CREATE USER BATMAN@BATCAVE WITHOUT LOGIN

    select * from sys.database_principals --[BATMAN@BATCAVE]

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply