SQL Server 2008 - permission denied in the 'master' database

I am new to SQL Server and I wanted to create my first table there.

create table Employee ( ID smallint not null ) 

I am using SQL Server 2008 R2 and Windows Authentication.

when I perform, he says:

 CREATE TABLE permission denied in database 'master'. 

Thanks!

+4
source share
2 answers

It seems you are trying to create a table in the master database, where you may not have permission to create the table. However, to create the target database, follow these steps:

a. In the SQLQuery editor, select the target database ( Available Database drop-down list) and execute your SQL query.

or

b. Try the following statement:

 USE YourTargetDatabaseName GO CREATE TABLE Employee ( ID SMALLINT NOT NULL) GO 
+6
source

I do not think you want to create a table in the main database.

Did you create a new database first? If so, use this:

 USE [MyNewDatabaseName] GO create table Employee ( ID smallint not null ) GO 
+5
source

Source: https://habr.com/ru/post/1385739/


All Articles