[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3242
  • Last Modified:

Getting error with sp_addlogin - is not a valid name because it contains invalid characters.

Getting error with sp_addlogin -  is not a valid name because it contains invalid characters.

The statement is:
sp_addlogin 'DE-PROD\TX_A_Db_datareader'

How can I get this to work.  It parses fine though...
0
dfr031260
Asked:
dfr031260
1 Solution
 
JoeNuvoCommented:
1. Logins cannot contain a backslash (\)

2. if you try to add windows user into SQL.
   try following command

CREATE LOGIN [DE-PROD\TX_A_Db_datareader] FROM WINDOWS
0
 
dfr031260Author Commented:
I think I found the answer, sp_addlogin does not work for domain users, you have to user create login:

CREATE LOGIN [DE-PROD\TX_A_Db_backupoperator] FROM WINDOWS WITH DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english];

This does work...ugh
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now