I tried creating a user with all privileges but I am getting this error:
Microsoft SQL Server Management Studio
Create failed for User 'Hru'. (Microsoft.SqlServer.Smo)
Additional information:
An exception occurred while executing a Transact-SQL statement or batch.
(Microsoft.SqlServer.ConnectionInfo)'Hru' is not a valid login or you do not have permission. (Microsoft SQL Server, Error: 15007)
Can anybody help me solve this?
Best Answer
The error message is stating that SQL Server cannot locate a login named
Hiru
, or you do not have the privilege required to create a user.The SQL Server security model consists1 of a server-level login that provides access at the instance level. Logins are then associated to a user inside each database. The user typically has the same name as the login, although that is not required.
Creating a login and user is easy to do with T-SQL, as in:
Using a T-SQL script provides more direct control over the process, and allows better troubleshooting.
1 - unless you're using the contained database security model