thormayer
thormayer

Reputation: 1070

SQL Server 2008 - permission denied in database 'master'

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

create table Employee
(
    ID smallint not null
)

I use SQL Server 2008 R2 and Windows Authentication.

when I execute , it says :

CREATE TABLE permission denied in database 'master'.

Thanks!

Upvotes: 4

Views: 5452

Answers (2)

danludwig
danludwig

Reputation: 47375

I don't think you want to create a table in the master database.

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

USE [MyNewDatabaseName]
GO

create table Employee ( ID smallint not null )
GO

Upvotes: 5

Elias Hossain
Elias Hossain

Reputation: 4469

Seems you're trying to create the table in master database where you may not have permission to create table. However, to create your target database please follow below steps:

a. At your SQLQuery editor choose your target database (Available Database drop down list) and execute your sql query.

Or

b. Try with below statement:

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

Upvotes: 6

Related Questions