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)
 make stored proc a dbo?

Author  Topic 

Brittney10
Posting Yak Master

154 Posts

Posted - 2011-03-08 : 10:08:37
I'm having problems making a stored proc a database object. Before, I just put "dbo" in front of the sp name like dbo.somename. Now when i try to do that i get:


Invalid object name 'dbo.somename.


webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-03-08 : 10:19:09
It should work.
Please show us the complete statement.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

Brittney10
Posting Yak Master

154 Posts

Posted - 2011-03-08 : 10:32:37
It's a really simple stored proc. And i'm thinking it has nothing to do with my sp. The stored proc works if i just allow the stored proc to be a user object, but i can't have that in my database...i need database objects.


USE [DB_NAME]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE dbo.[SP_Name]
(
@NAME nvarchar(255),
@DEPT nvarchar(255)
)
AS
INSERT INTO TABLE1
(NAME)
VALUES (@NAME)
INSERT INTO TABLE2
(NAME)
VALUES (@NAME)
INSERT INTO TABLE3
(DEPT, NAME)
VALUES (@DEPT, @NAME)
Go to Top of Page
   

- Advertisement -