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

  • Home
  • SEARCH
  • 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 4074818
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:13:09+00:00 2026-05-20T17:13:09+00:00

All, In SQL Server, can a stored procedure (beeing ran from a user) write

  • 0

All,

In SQL Server, can a stored procedure (beeing ran from a user) write to table where the user doesn’t have access to write directly to the table?

Rgds,

MK

  • 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-20T17:13:10+00:00Added an answer on May 20, 2026 at 5:13 pm

    The correct answer is NO, a stored procedure does not have access to write into a table. However most users perceive it, incorrectly, as YES because of Ownership Chains:

    When multiple database objects access
    each other sequentially, the sequence
    is known as a chain. Although such
    chains do not independently exist,
    when SQL Server traverses the links in
    a chain, SQL Server evaluates
    permissions on the constituent objects
    differently than it would if it were
    accessing the objects separately.
    These differences have important
    implications for managing security.
    Ownership chaining enables managing
    access to multiple objects, such as
    multiple tables, by setting
    permissions on one object, such as a
    view.

    So a procedure will be able to write into a table that the user has no permissions to write into if they form an ownership chain. This means that if the owner of the schema that contains the table is the same as the owner of the schema that contains the procedure, an ownership chain is formed and the procedure is allowed to write into the table. Since the vast majority of objects deployed in practice belong to the dbo schema, an ownership chain is almost always formed.

    It is important to comprehend these details, so you can troubleshoot problems and understand why is the procedure allowed to write into the table. Erland Sommarskog has an excellent comprehensive write up on this topic: Giving Permissions through Stored Procedures. This article goes into great detail explaining all the options available. Your best option, far better than ownership chaining, is code signing.

    Understanding how this works also helps understanding why dynamic SQL seems to ‘break’: running dynamic SQL is an automatic break in the ownership chain, which causes all ‘magic’ to disappear. And it also helps understand why this ‘magic’ appears not to work outside the database: cross db ownership chaining Option default value is 0.

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

Sidebar

Related Questions

If all my sql server database access is done thru stored procedures, and I
In SQL Server 2000, you have the All Tasks... - Export Data option. Where
I need to enumerate all the user defined types created in a SQL Server
We have a SQL Server 2005 database, and currently all our users are connecting
We have a Single Statement FUNCTION in SQL Server 2005 which uses CONTAINSTABLE(). All
In SQL Server how do you query a database to bring back all the
In SQL Server 2005, are there any disadvantages to making all character fields nvarchar(MAX)
My log file in SQL Server used up all the space on my disk.
I am using SQL Server 2005, I want to find out what all the
I need to create several applications that all share a Microsoft SQL Server database.

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.