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 117725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:22:54+00:00 2026-05-11T03:22:54+00:00

I am working on a product that runs an SQL server which allows some

  • 0

I am working on a product that runs an SQL server which allows some applications to login and their logins are granted permission to run a stored procedure- AND NOTHING ELSE. The stored procedure is owned by an admin; the stored procedure takes a query and executes it, then the results are returned to the application.

Unfortunately I can’t figure out why the application can call the stored procedure to which it’s granted access, but the stored procedure cannot execute the SQL statement which was passed into it.

The stored procedure executes the passed in query when I’m logged in as an admin, but when I log in as the limited user it throws an exception in the execute statement.

For example:

EXEC [Admin].[STORED_PROC] @SQL_STATEMENT = 'SELECT * FROM table_x' 

the STORED_PROC looks something like this:

BEGIN TRY    EXEC (@SQL_STATEMENT) END TRY BEGIN CATCH    -- some logging when an exception is caught, and the exception is caught here!!! END CATCH 

There is nothing inside the the try catch statement except that EXEC… and the SQL_STATEMENT works when I’m logged in as the Admin, but not when I’m logged in as the User.

Can anybody help me figure out what permissions I need to set in order to allow the User to run queries through the stored proc only?


So there have been some comments about allowing raw SQL statements to be executed via stored proc defeats the purpose of using a stored proc… but in reality what we’re actually doing is we’re passing an encrypted SQL statement into the stored proc and the stored proc gets the statement decrypted and THEN it executes it.

So yes, in reality raw SQL statements are not secure and they defeat the purpose of stored procs, but I don’t know how to encrypt SQL queries that are passed through ODBC and run against a pre-2005 SQL Server.

In any case, I tried to put up some minimal safeguards to at least have some basic security.

  • 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. 2026-05-11T03:22:55+00:00Added an answer on May 11, 2026 at 3:22 am

    Since you are using dynamic sql, SQL server can’t tell which tables you are using, so you have to grant SELECT rights to all the tables as well

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

Sidebar

Ask A Question

Stats

  • Questions 94k
  • Answers 94k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer For me what this comes down to is where you… May 11, 2026 at 6:51 pm
  • Editorial Team
    Editorial Team added an answer I know this is not the answer your looking for,… May 11, 2026 at 6:51 pm
  • Editorial Team
    Editorial Team added an answer In order to do this you will need to keep… May 11, 2026 at 6:51 pm

Related Questions

I wonder how you guys manage deployment of a database between 2 SQL Servers,
I am working on a testing framework for the software that my company writes.
I am working on a simulation system. I will soon have experimental data (histograms)
A product that I am working on collects several thousand readings a day and

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.