1

I am unable to create a database in SQL Server 2008. This is the message that I recieve every time:

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

Create failed for Database 'university'.  (Microsoft.SqlServer.Smo)

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

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

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

CREATE DATABASE permission denied in database 'master'. (Microsoft SQL Server, Error: 262)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.00.1600&EvtSrc=MSSQLServer&EvtID=262&LinkId=20476

What should be done?

2 Answers 2

2

This is related to the permission of the logged in user.
Solution 1)
Click on Start -> Click in Microsoft SQL Server 2005
Now right click on SQL Server Management Studio
Click on Run as administrator

Solution2)

check with select user_name() if you are not logged in as guest.

Add a domain account as sysadmin to SQL Express with SQLCMD

Start a command shell elevated
type SQLCMD –S (local)\sqlexpress

CREATE LOGIN [your domain account] FROM WINDOWS;

check if the login is created successfully

SELECT NAME FROM SYS.SERVER_PRINCIPALS

Grant sysadmin rights

SP_ADDSRVROLEMEMBER ‘darth\vader’, ‘sysadmin’

Reference : http://blogs.msdn.com/b/dparys/archive/2009/09/17/create-database-permission-denied-in-database-master-my-fix.aspx

Sign up to request clarification or add additional context in comments.

Comments

2

You need to give the account your using permission to create databases.

You may need to login using the sa account and perform a GRANT on the user account.

GRANT CREATE DATABASE TO YourAccount;

http://msdn.microsoft.com/en-us/library/ms178569.aspx

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.