Error: 15006 'username' not a valid name because ...

  • Dear

    I'm new to SQL and trying  to learn the basic in a practical way.

    The error:

    TITLE: Microsoft SQL Server Management Studio
    ------------------------------

    Create failed for Login '.\TestAccount'. (Microsoft.SqlServer.Smo)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=14.0.17285.0+((SSMS_Rel_17_4).180821-0238)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Create+Login&LinkId=20476

    ------------------------------
    ADDITIONAL INFORMATION:

    An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

    ------------------------------

    '.\TestAccount' is not a valid name because it contains invalid characters. (Microsoft SQL Server, Error: 15006)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=13.00.5026&EvtSrc=MSSQLServer&EvtID=15006&LinkId=20476

    ------------------------------

    I tried computername\username , but it seems that the \ is seen as part of the username.

    When I select Windows authentication, there is no problem toaccept the username.

    But I need the user to be in SQL SERVER authentication mode and not windows authentication mode.

    Now I'm not even sure if the software , where the user TestAcount is present, is the same as the windows user.. .

    Hope someone can clearify me if it's possible to have a new login in SQL server 2016 express edition, I'm using MSSMS V17.9.

  • It seems you forgot to include the most important part: the actual T-SQL you used. ??

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • Thom A - Saturday, November 17, 2018 11:58 AM

    It seems you forgot to include the most important part: the actual T-SQL you used. ðŸ˜

    I'm not yet familiar with T-SQL commands, I only used the Microsoft SQL Server Management Studio (Administrator).

    that is the only tool I work with to add users..

    But it's possible I did misunderstand. I maybe  undertand better  by now ( hours of googling) , That it's not possible to add a windows user account  in security folder as a login with SQL authentication.
    I need to add a non windows account.

  • by the error you posted it seems you tried to use a format that is not possible
    Create failed for Login '.\TestAccount'.
    drop that .\ and it will work

  • hara_mo - Saturday, November 17, 2018 12:34 PM

    Thom A - Saturday, November 17, 2018 11:58 AM

    It seems you forgot to include the most important part: the actual T-SQL you used. ðŸ˜

    I'm not yet familiar with T-SQL commands, I only used the Microsoft SQL Server Management Studio (Administrator).

    that is the only tool I work with to add users..

    But it's possible I did misunderstand. I maybe  undertand better  by now ( hours of googling) , That it's not possible to add a windows user account  in security folder as a login with SQL authentication.
    I need to add a non windows account.

    Then use the tool to output the script and share that..

    The syntax for creating a non-windowd login, for example, would be:
    [Code] CREATE LOGIN TestAccount WITH PASSWORD = 'ABCdef123!?', CHECK_EXPIRATION = OFF, DEFAULT_LANGUAGE = British;[/code]

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • \TestAccount cannot be used for a SQL login name as \ is not allowed. SQL Server authentication on the General page when you create a new login

  • hara_mo - Saturday, November 17, 2018 12:34 PM

    Thom A - Saturday, November 17, 2018 11:58 AM

    It seems you forgot to include the most important part: the actual T-SQL you used. ðŸ˜

    I'm not yet familiar with T-SQL commands, I only used the Microsoft SQL Server Management Studio (Administrator).

    that is the only tool I work with to add users..

    But it's possible I did misunderstand. I maybe  undertand better  by now ( hours of googling) , That it's not possible to add a windows user account  in security folder as a login with SQL authentication.
    I need to add a non windows account.

    That's correct. You wouldn't add a Windows account as a login that uses SQL authentication. Why would you want to? You either set up the Windows account to use Windows authentication or you create an entirely separate login (with the name restricted to the allowable characters) to use SQL authentication.

Viewing 7 posts - 1 through 6 (of 6 total)

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