Меню

Ошибка 262 sql server как решить

I’m opening the SQL Server Management Studio with run as administrator

And there is no problem with Windows Authentication Connection.

I’m choosing «New Database» by right-click the Databases folder.

And giving name ‘BTS’ for the Database.

When i’m choosing OK, i get the error as,

enter image description here

How to fix it?

a_horse_with_no_name's user avatar

asked Jun 13, 2014 at 5:42

Sam1604's user avatar

From this blog post

To add a Windows user that has the login “machinenameAdministrator”
to the sysadmin fixed server role

  1. Log on to the computer using the credentials for the
    machinenameAdministrator account.
  2. Click the Start button, point to All Programs, click Microsoft SQL
    Server, and then click SQL Server Management Studio.
  3. Connect to an instance of SQL Server.
  4. Click Security, right-click Logins, and then click New Login.
  5. In the Login name box, enter the user name.
  6. In the Select a page pane, click Server Roles, select the sysadmin
    check box, and then click OK.

To add a Windows user that has the login “domainname username” to the
sysadmin fixed server role

  1. Log on to the computer using the credentials for the
    domainnameusername account.
  2. Click the Start button, point to All Programs, click Microsoft SQL
    Server, right-click SQL Server Management Studio, and then click Run
    as administrator.

    ps: “Run As Administrator” option elevates the user permissions In
    the User Access Control dialog box, click Continue.

  3. In SQL Server Management Studio, connect to an instance of SQL
    Server.
  4. Click Security, right-click Logins, and then click New Login.
  5. In the Login name box, enter the user name.
  6. In the Select a page pane, click Server Roles, select the sysadmin
    check box, and then click OK.

bob esponja's user avatar

bob esponja

4,0833 gold badges31 silver badges29 bronze badges

answered Jun 13, 2014 at 5:52

Vignesh Kumar A's user avatar

Vignesh Kumar AVignesh Kumar A

27.5k12 gold badges60 silver badges110 bronze badges

Click Start —> All Programs —> SQL Server Management Studio Express

SQL Server Management Studio Express—> Right Click—>Run as Administrator—> Click Yes

It works

answered Nov 21, 2014 at 4:56

Naveen Goud's user avatar

0

you are probably running more than one user profile on your laptop. While opening the program, right click and run as administrator

answered Jan 18, 2022 at 1:53

Jlah Lami's user avatar

try this:
SqlSever>>Security>>Logins>>BUILTINUsers rightClick —>Properties
—>Server Roles
…select sysadimn

answered Apr 5, 2022 at 7:24

Ram-25's user avatar

1

  • Remove From My Forums
  • Вопрос

  • Здравствуйте! У меня такой вопрос. Когда я пытаюсь создать базу данных с помощью SQL Server Management Studio Express, у меня возникает ошибка:

    Msg 262, Level 14, State 1, Line 1

    CREATE DATABASE permission denied in database ‘master’. 

    Я новичок. Подскажите пожалуйста, как мне решить данную проблему. Заранее благодарен за ответ.

Ответы

  • Нехватает прав. Залогиньтесь либо под sa либо под Windows аккаунтом (который вы указали как администратора при установке).

    • Помечено в качестве ответа

      8 февраля 2011 г. 5:27

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:

Microsoft SQL Server Error 262

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 ‘machinenameAdministrator’

  • Log on the Computer using account details of machineadministrator
  • 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 ‘domainnameusername’

  • Using the account details of domainnameusername, 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.

Descriptive Solution to Fix Microsoft SQL Error 262

I am launching Microsoft SQL Server management studio by running it with option of ‘Run as administrator’. I am facing none of the errors at the time of establishing Windows Authentication connection. But, when I select the option for creating ‘new database’, I encounter an error dialog box. This dialog box is restricting me from creating new database in SQL server. I don’t know what has happened in the servers but, all what I want is to fix the problem ASAP. Is there any SQL expert who can provide solution for this SQL error 262?

One of the popular error faced by Microsoft server administrators is denial of permissions to create a new database in MS SQL server management studio. Microsoft SQL server database creation error 262 usually occurs due to the presence of some issue in Windows Authentication connection. The error statement states that the current account is not having rights to sign into the SQL server.

Microsoft SQL server database creation error 262

Measures to Quickly Fix SQL Error 262

Following illustrated are the solution for troubleshooting the SQL server database creation error 262 in shortest time duration :

Measure 1 : Permit Database Access to Single User

The SQL server error 262 appears when the server users try to verify the execution plan via Ctrl + M. In comparison to the execution plan, it is quite tough to view the query plan. Therefore, an execution plan is calculated in place of the query plan, which is initiated without running the SQL server query plan. The main aim of doing so is to analyze the behavior of query, prior to its execution. Execution plan in a query can be consolidated by permitting end users with SHOWPLAN access. Following commands will help in resolving the Microsoft SQL error 262 after giving SHOWPLAN access permission :

USE DatabaseName
GO
GRANT SHOWPLAN TO UserName
GO

Execute the commands on the database where you are facing problem at the time of database creation in SQL server.

Measure 2 : Fix the Error Using Microsoft SQL Express

There might be a condition where end users face SQL server database creation error 262 when they are trying to establishing connection between the local instance of SQL server and 3rd party app. In this scenario, use following steps for SQL error 262 fixation :

1. Click on Start >> All Programs >> Microsoft SQL Server >> Configuration Tools >> SQL Server Surface Area Configuration
2. Click on the Add New Administrator and then navigate towards ‘Member of SQL Server SysAdmin role on SQLEXPRESS
3.  Add the respective option in the right-box and then, click on OK button

Now there are two methods for adding Windows OS users in the SysAdmin fixed server role. Description of both these approaches are mentioned-below :

Using ‘machinenameAdministrator’

  • Sign-in into your Computer via account information of machineadministrator
  • Click on Start >> All Programs >> Microsoft SQL Server >> SQL Server Management Studio
  • Now establish a connection with SQL Server instance to proceed with resolving of SQL error 262
  • Click on the Security tab and right-click on Logins
  • From the list of options, select New Login option
  • Now in the login name box, type the new username
  • Navigate towards Select a page, choose the Server Roles and then, enable the checkbox of SysAdmin
  • At last, click on OK button to fix Microsoft SQL server database creation error 262

Using ‘domainnameusername’

  • Make use of domainnameusername credentials to login to the PC
  • Click on Start >> All Programs >> Microsoft SQL Server and then, right-click on the SQL Server Management Studio
  • Choose the option of Run As Administrator
  • When connection with SQL Server instance gets established, click on Security Tab
  • Right-click on the Logins for creation of new username
  • Go to the Select a Page section and click on Server Roles
  • Activate the checkbox of SysAdmin and then, click on OK

That’s It For Problem Resolving

All possible measures to troubleshoot SQL error 262 at the time of database creation is illustrated in this post. Microsoft server administrators can execute these measures, if they are encountering same sort of problem. The solutions are provided by Invorx team of SQL experts and they give assurance that one of the provided solutions will definitely work on your platform.

  • Remove From My Forums
  • Вопрос

  • Hey everyone I’m trying to create a new database in SQL Server 2012 and keep getting the 262 error.  (Create database permission denied in database «master».(microsoft sql server error:262)

    I’m running on Windows 7 home premium 64 bit, am on the administrative account and have set permissions in the properties to allow me to do everything…

    I’m not sure what else to try and any help would be much appreciated! Thanks in advance.

    -Joe

     

Ответы

  • hello Joseph

    could you try to create using t-sql in a query window?

    try the following:

    CREATE DATABASE [test]
    

    then try with explicitely specifying the path to the files.

    CREATE DATABASE [test1] ON  PRIMARY 
    ( NAME = N'test1', FILENAME = N'C:TEMPtest1.mdf' )
     LOG ON 
    ( NAME = N'test1_log', FILENAME = N'C:TEMPtest1.ldf')
    

    replace the path c:temp by a directory of your choice where the SQL Server service account does have full control.

    could you please check the default setting for database default locations ? start SSMS, connect to server, select server, open Properties dialog, select «Database Settings», check «Database default locations», they must not be empty and the SQL Server service
    account needs read/write access to this folder.


    Please use Mark as Answer if my post solved your problem and use Vote As Helpful if a post was useful.

    • Помечено в качестве ответа

      17 мая 2012 г. 8:48

  • You said «I set it to windows authentication only» and you also said «am using the SA account». These are mutually exclusive. That is, if your instance of SQL Server is set to Windows Authentication only, then the sa account cannot be used to connect. So…
    I think you must really be connecting using your domain login and Windows Authentication. And that account is probably not a member of the sysadmin fixed server role. These three queries will help you figure out who SQL Server thinks you are, and what permissions
    you have.

    SELECT SUSER_NAME() AS YourLogin, USER_NAME() AS YourDBUserIdentity;
    SELECT IS_SRVROLEMEMBER(‘sysadmin’) AS True_is1_False_is0;
    SELECT permission_name, state_desc FROM sys.server_permissions WHERE grantee_principal_id = SUSER_ID();


    Rick Byham, Microsoft, SQL Server Books Online, Implies no warranty

    • Помечено в качестве ответа
      Maggie Luo
      17 мая 2012 г. 8:48

  • Remove From My Forums
  • Question

  • Hello Everyone,

    I just bought a new computer, installed Windows 10 pro, sql server 2014 Express + SSMS 2016 Preview.

    I have done this many times before and it always worked.

    1. I start SSMS «As Administrator» with Windows Authentication Mode.
    2. Then I try to create a new Database and I get an exception message.

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

    SSMS 2014 Express did not work either.

    I would any appreciate any help greatly! Kindest Blessings


    Andreas Bolliger

Answers

  • Dear Andreas,

    restart the sql server service in single user mode.

    You have to add -m as a startup parameter in configuration manager and restart the service:

    From this point you will be able to connect with any local windows administrator via sqlcmd as a sysadmin (only possible in single user mode for fixing those issues)

    sqlcmd -S .<YourInstance>

    Now create your missing login

    CREATE LOGIN [<YourLogin>] FROM WINDOWS;

    GO

    Do not forget to add the created login to the sysadmin server role:

    exec sp_addsrvrolemember [<YourLogin>], sysadmin;
    GO

    Remove the -m startup parameter in SQL Server configuration manager, restart your instance and you will be able to be the real sysadmin.

    PS: the correct way is realy to add an administrative login during setup. But afterwards this way will fix your problem without re-installing your sql server.

    Best Regards

    Kai

    • Proposed as answer by

      Wednesday, May 11, 2016 8:33 PM

    • Edited by
      Koppelmann, Kai
      Wednesday, May 11, 2016 8:34 PM
      Formatting
    • Marked as answer by
      BolligeA
      Wednesday, May 11, 2016 8:40 PM

  • Remove From My Forums
  • Question

  • Hello Everyone,

    I just bought a new computer, installed Windows 10 pro, sql server 2014 Express + SSMS 2016 Preview.

    I have done this many times before and it always worked.

    1. I start SSMS «As Administrator» with Windows Authentication Mode.
    2. Then I try to create a new Database and I get an exception message.

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

    SSMS 2014 Express did not work either.

    I would any appreciate any help greatly! Kindest Blessings


    Andreas Bolliger

Answers

  • Dear Andreas,

    restart the sql server service in single user mode.

    You have to add -m as a startup parameter in configuration manager and restart the service:

    From this point you will be able to connect with any local windows administrator via sqlcmd as a sysadmin (only possible in single user mode for fixing those issues)

    sqlcmd -S .<YourInstance>

    Now create your missing login

    CREATE LOGIN [<YourLogin>] FROM WINDOWS;

    GO

    Do not forget to add the created login to the sysadmin server role:

    exec sp_addsrvrolemember [<YourLogin>], sysadmin;
    GO

    Remove the -m startup parameter in SQL Server configuration manager, restart your instance and you will be able to be the real sysadmin.

    PS: the correct way is realy to add an administrative login during setup. But afterwards this way will fix your problem without re-installing your sql server.

    Best Regards

    Kai

    • Proposed as answer by

      Wednesday, May 11, 2016 8:33 PM

    • Edited by
      Koppelmann, Kai
      Wednesday, May 11, 2016 8:34 PM
      Formatting
    • Marked as answer by
      BolligeA
      Wednesday, May 11, 2016 8:40 PM

0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии

А вот еще интересные материалы:

  • Яшка сломя голову остановился исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного где ошибка
  • Ошибка 2616 002 мерседес
  • Ошибка 2649 тойота рав 4