An Effective Solution to Resolve SQL Server Error 262
Problem
One of the common errors faced by SQL Server Database users is denial of permission while trying to create a new database in SQL Server Management Studio displaying an error code 262. The problem is encountered due to issues in Windows Authentication Connection that states that the account does not have rights to login to SQL Server. The SQL Server Error 262 displays the following error message defined below:
Solutions To Fix Microsoft SQL Server Error 262
Below are the possible solutions to resolve the create database permission denied error 262:
Grant Database Access to a single user
SQL Server Error 262 can appear when user tries to check the execution plan using CTRL + M. As it is difficult to see the plan for any query, execution plan can be used. A calculated execution plan is a SQL Server query plan that is created without actually running the query plan. Its main purpose is to check how query will behave without having to execute it. In order to include the execution plan in the query, we can allow user to grant SHOWPLAN access to the user. Fixing the error is possible by providing particular user the SHOWPLAN access using following commands:
USE DatabaseName
GO
GRANT SHOWPLAN TO UserName
GO
We can run the commands in the database where user faces the issue to make them view the query execution plan without any complications.
Resolve issue in SQL Express
User may encounter Microsoft SQL Server Error 262 while trying to connect to local SQL Server Express Instance from a third party application. We can fix the issue using the steps below:
- Go to Start> All Programs > Microsoft SQL Server> Configuration Tools >SQL Server Surface area Configuration
- Click on Add New Administrator
- Go to ‘Member of SQL Server SysAdmin role on SQLEXPRESS’ and Add it to right-box
- Click on OK
There are two ways to add Windows user to the SysAdmin fixed server role:
In case of ‘machinename\Administrator’
- Log on the Computer using account details of machine\administrator
- Go to Start> All Programs > Microsoft SQL Server >SQL Server Management Studio
- Now, we will connect to an instance of SQL Server
- Go to Security tab, right-click on Logins and then Click New Login
- Enter a new user name on the login name box.
- Go to Select a page, select Server Roles and click on check box of SysAdmin and then OK
In case of ‘domainname\username’
- Using the account details of domainname\username, log on to the computer
- Go to Start> All Programs > Microsoft SQL Server and right-click on SQL Server Management Studio and select Run as Administrator
- After connecting to an instance of SQL Server, go to Security Tab> right-click on Logins to create a new user name
- Click on Server Roles under Select a Page tab, click on check box of SysAdmin and then click on OK
Conclusion
The blog has been aimed to focus on one of the SQL Server Error that user encounters while trying to create a new database, i.e. Microsoft SQL Server error 262. It further describes the possible solutions to guide users in resolving the create database permission denied error.