SQL Reporting Services – “Cannot find the object” error

I was trying to get a Matrix working on SQL Reporting Services when I ran across this error:

Cannot find the object ‘dbo.HooperSnooper’ because it does not exist or you do have permissions

Well, it did exist and I did have permissions to it. At least, I thought I did.

The “solution” was to drop the procedure, recreate it, and grant the db_executor account permissions to the stored procedure:

GRANT EXECUTE ON [dbo].[HooperSnooper] TO db_executor
GO

The first time I tried, it didn’t work. That was because I forgot to put the GO command after I created the SP. The correct syntax is (drum roll)…

CREATE PROCEDURE [dbo].[HooperSnooper]
 @Hooper int,
 @Snooper int
AS
BEGIN
 SELECT *
 FROM HooperSnooper
 WHERE Hooper = @Hooper
 AND Snooper = @Snooper
END
GO
GRANT EXECUTE ON [dbo].[HooperSnooper] TO db_executor
GO

I must have missed a GO statement somewhere along the line. Those GOs are important, or so I’ve heard.

Advertisements
  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: