CREATE TABLE permission denied in database 'tempdb'

Viewed 95060

First time I installed SQL Server Management Studio Express and Visual Studio 2005 on my system. Now I am trying to create table by using below script. But if once I execute I am facing error like

CREATE TABLE permission denied in database 'tempdb'.

Why it it? Can anyone help me how to resolve this ?

USE [tempdb]
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Employee]
([FirstName] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
 [LastName] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]

Thanks Raju

6 Answers

I'm not sure if this answer will be helpful, but I experienced a similar problem and this is how I solved it. The issue I was experiencing was due to the fact that my 'create table' was defaulting to tempdb and I needed to specify the database name. As others have stated, I checked with my DB access operators to make sure I had create table permissions. Since I had the necessary permissions already, I came up with the solution below.

The following returned the tempdb error:

driver={SQL Server};server=YOUR_SERVER_NAME;trusted_connection=true

Once I included the database name, the code worked fine. Here is the code that worked for me:

driver={SQL Server};server=YOUR_SERVER_NAME;database=YOUR_DATABASE_NAME;trusted_connection=true'

I hope this post is helpful!

Related