Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Msg 2760, Level 16, State 1, Line 3

Author  Topic 

Rock_query
Yak Posting Veteran

55 Posts

Posted - 2013-03-28 : 17:30:22
I am using the AdventureWorks2012 database in SQL Server Express on my laptop. I am trying to create a new table. Here is my code:



CREATE TABLE Person.ProjMgr (
firstName VARCHAR (25) NULL,
middleName VARCHAR (2) NULL,
lastname VARCHAR (25) NULL,
ID INT NULL,
deptID tinyint NULL,
productName VARCHAR (50) NULL,
City VARCHAR (25) NULL,
State VARCHAR (2) NULL,
zipCode SMALLINT NULL
)



Here is the error message:

Msg 2760, Level 16, State 1, Line 3
The specified schema name "Person" either does not exist or you do not have permission to use it.


Yesterday, I have created tables under the "Person" schema with no problem at all. I am trying other schemas in place of the 'Person' schema such as 'Production' and I am still getting the same error.

Why am I no longer able to create tables under these schemas now? How do I give myself permission to use any of these schemas?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2013-03-28 : 17:39:45
You are probably in the wrong database.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-03-28 : 17:40:58
Are you in the right database?

query to find if you have permission to create schema
select * from fn_my_permissions(NULL, 'DATABASE') where permission_name like '%schema%'
Go to Top of Page

Rock_query
Yak Posting Veteran

55 Posts

Posted - 2013-03-28 : 21:22:00
quote:
Originally posted by tkizer

You are probably in the wrong database.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog



I closed out the query tab and opened a new one. Now it works. The new tab has seems to indicate a connection to the database I need.

The title of the previous tab said something about no connection.

Thank you for your help.
Go to Top of Page
   

- Advertisement -