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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Specified schema name either does not exist or ...

Author  Topic 

duanecwilson
Constraint Violating Yak Guru

273 Posts

Posted - 2010-07-07 : 10:57:28
Msg 2760, Level 16, State 1, Procedure InsertRecordTo_cvr_upload_SAM_ctl, Line 7
"Specified schema name 'msdn' either does not exist or you do not have permission to use it."

This is a local database on my computer using a trusted connection as dbo, and I created the msdn schema myself. I have been creating tables and other operations in this schema using the fully qualified name.
When I run the below INSERT statement by itself with the commented out values, it runs fine. When I try to create the stored procedure with the parameter line in it (commenting out or removing the test values at the end), it fails with the above error. The error highlights the INSERT statement inside the procedure even though it runs fine by itself. What am I missing?
CREATE PROCEDURE msdn.InsertRecordTo_cvr_upload_SAM_ctl
@DATA_SOURCE Varchar(4) = 'SAM',
@AS_OF_DATE Varchar(6) = 190001,
@RECORD_COUNT Int = 1,
@QUANTITY_TOTAL Int = 1
AS
INSERT INTO SoftwareReporting.msdn.cvr_upload_SAM_ctl ( RECORD_COUNT, QUANTITY_TOTAL ) --VALUES (1,2)
VALUES ( @RECORD_COUNT, @QUANTITY_TOTAL )

GO
One more thing - dbo owns the schema msdn. Thank you.

Duane

duanecwilson
Constraint Violating Yak Guru

273 Posts

Posted - 2010-07-07 : 12:09:58
It turns out that in SSMS, I was 'USING' the MASTER database instead of SoftwareReporting (I wish there was a template parameter to enter what database you are using), but when I set it to the correct database, it worked as expected.




Duane
Go to Top of Page
   

- Advertisement -