Reputation: 127
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?
Upvotes: 1
Views: 2148
Reputation: 6043
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’
Upvotes: 2
Reputation: 70718
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
Upvotes: 2