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
 stored procedure error

Author  Topic 

bill_
Starting Member

38 Posts

Posted - 2013-09-25 : 10:23:24
Trying to write a stored procedure.

Clicked on parse from the query menu and got message "Command(s) executed successfully."

Then clicked on execute from the query menu and got message "The specified schema name [dbo] either doesn't exist or you do not have permission to use it."

How is this fixed and/or what specific permissions do I need ?

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-09-25 : 10:47:20
Parsing does only a syntax check. If you had a statement like "exec dbo.ThisStoredProcedureDoesNotExist", and clicked on parse, it will parse with no errors. So successful parsing by itself doesn't tell you anything.

First thing to check is whether the stored procedure indeed exists in the database. In SSMS object explorer, expand the stored procedures node under the database name -> Programmability and make sure it is there. If it is there, then you need permission to execute it. You won't be able to grant yourself permission, so you will need to login using a higher priviledged login and do "grant execute on StoredProcName to YourUsername"
Go to Top of Page

bill_
Starting Member

38 Posts

Posted - 2013-09-25 : 11:22:57
Someone with a higher priveleged login did that and now the stored procedure is in the database. Thank you for that.

Still have a problem, when execute is clicked, output doesn't show.
Have tried print('test') and a working query between the begin-end but get "Command(s) executed successfully." and no results.

What could be missing or being done wrong ?
Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-09-25 : 13:04:32
Is the stored procedure supposed to return any rows at all?

Does it require any parameters? Parameters can be created as optional, and if the code is set up to return no results when there are no parameters, this could happen.

Do you have visibility into the stored procedure code? If so, look through it to see what it is doing and why it is not returning any rows.

Is anyone else able to run the stored procedure and get return results?
Go to Top of Page

bill_
Starting Member

38 Posts

Posted - 2013-09-25 : 15:30:41
Thank you very much.
Got it to work.
Go to Top of Page
   

- Advertisement -