How (in SQL Server) to create a database and create a user and this user will be an admin on this database only with SQL script? I mean this user can not do/access any thing out side this database!
and is it possible to create user that has only can add, update/edit or delete data from tables and nothing else?
I know how to do that in MySQL, but not sure how with SQL Server!
Assuming that you are using windows auth with a login ‘domain\user’ that has already been created.
Alternatively to give the user admin over the database, replace the last two lines with.
CREATE DATABASEalso has many options which you might need that can be found on BOL.http://msdn.microsoft.com/en-us/library/ms176061.aspx
If you need to create a
loginalso then you will need the following before creating theUSERon your database.