Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7161397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:33:36+00:00 2026-05-28T13:33:36+00:00

SQL Server 2008 R2: normally, we create our table, and stored procedure, and grant

  • 0

SQL Server 2008 R2: normally, we create our table, and stored procedure, and grant a user execute rights to the stored procedure. We never have to grant specific rights to the tables or views because if they user can execute the stored procedure SQL Server infers that the stored procedure should be allowed to perform the select/insert/update statements. Works well because we’re only dealing with one schema, but now we’ve got a scenario where the tables are in one schema, but a stored procedure is in another. When the user executes the stored procedure, they get an error:

Msg 229, Level 14, State 5, Procedure teststoredprocedure, Line 7 The
SELECT permission was denied on the object ‘testtable’, database
‘testdatabase’, schema ‘testschema’.

teststoredprocedure is in a different schema than testtable. Is it possible to allow the stored procedure to select from tables, without granting the user specific rights to those tables?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:33:37+00:00Added an answer on May 28, 2026 at 1:33 pm

    You need to give the owner of the stored procedure WITH GRANT access to the table.

    Generally a Schema is owned by a Role with the same name as the schema, so to allow storedprocschema.teststoredprocedure to access the table it would be:

    GRANT SELECT on testschema.testtable TO storedprocschema WITH GRANT
    

    This should work IF and only if the table is in the same database as the proc.

    To achieve the same result with a table in a different database you can either:

    • Enable “Cross Database Ownership Chaining”

    • Move the procedure to the other database, and have a shim procedure in the original database which calls it. Then manage permissions on both procedures.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

version:SQL Server 2008 R2 I have granted a user the ability to EXECUTE and
Using sql server 2008, I have a simple stored procedure, the contents of which
SQL Server 2008 R2 Why create table A ( id int, primary key nonclustered
A large SQL Server 2008 table is normally being updated in (relatively) small chunks
In SQL Server 2008, I have a table for tracking the status history of
Using SQL Server 2008, I have abc and xyz table abc abc_id | xyz_id1
In SQL Server 2008, I have a strongly typed data set with a table:
SQL Server 2008 doesn't always report a compile error when a stored procedure references
In Sql Server 2008, when I create a table without schema prefix: create table
SQL Server 2008 Database Question. I have 2 tables, for arguments sake called Customers

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.