SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Msg 2760, Level 16, State 1, Line 3
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Rock_query
Yak Posting Veteran

52 Posts

Posted - 03/28/2013 :  17:30:22  Show Profile  Reply with Quote
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

USA
37142 Posts

Posted - 03/28/2013 :  17:39:45  Show Profile  Visit tkizer's Homepage  Reply with Quote
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
Flowing Fount of Yak Knowledge

3712 Posts

Posted - 03/28/2013 :  17:40:58  Show Profile  Reply with Quote
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

52 Posts

Posted - 03/28/2013 :  21:22:00  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000