I\'m using this code to create a new user.
/****** Object: User [primebox] ******/
IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N\'primebox
Logins are different things than users, here is how to create a new LOGIN.
Right click SQL Server Management Studio and choose -> Run as adminstrator.
Login normally with the default Windows Authentication.
Choose Databases -> System Databases -> master. Click "New Query" button upper left.
Paste this query in there. (for more info SQL login options see here):
CREATE LOGIN youruser WITH PASSWORD = 'yourpassword'
You should get this response:
Command(s) completed successfully.
Check to make sure it got added to dbo.syslogins
select * from master.dbo.syslogins
Close and restart SQL Management server (as administrator) and restart SQL Server itself by going to the SQL Server Configuration panel and clicking restart.
In the object explorer click the main EL-PC\SQLEXPRESS -> Security -> Logins.
Your newly created login should be there, right click and go to properties, you have to grant that user permission to visit the default database, and set a default database.
Close SQL Server and login again with the SQL Server Authentication option and username/password. You should now be logged in with your new user.
How to create a new user
In SQL Server, users are different to logins.
To create a user for a database, you first have to create a login for the server using the create login syntax
In addition you can create a new login also by UI of the Sql Server Management Studio by clicking on the main security folder
and after creating the user