Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

SQL Insert permission being denied on external database using GP user accounts

(0) ShareShare
ReportReport
Posted on by 75,788 Moderator

I have added a VS C# application that has an option to run a stored procedure that exists in a GP database but this stored procedure writes to an external database. I have added the same users to this database and issued and ran GRANT.SQL on this database. I also created a DYNGRP schema and a DYNGRP role in this database. The problem is that when a GP user runs the stored procedure they get an error message about the INSERT permission has been denied. When I run GP as 'sa' it works so I know it is a security issue. Is there something else about how GP deploys security that I need to address to this external database so regular GP users can run this stored procedure? When I check the properties of users on this database the INSERT permission is checked.

Categories:
  • Richard Wheeler Profile Picture
    Richard Wheeler 75,788 Moderator on at
    RE: SQL Insert permission being denied on external database using GP user accounts

    Security rolls down from the user in GP so creating non-GP users is not an option.

  • Richard Wheeler Profile Picture
    Richard Wheeler 75,788 Moderator on at
    RE: SQL Insert permission being denied on external database using GP user accounts

    Somehow the user became the owner of the DYNGRP schema. Once I switched the owner back to DYNGRP insertion was possible.

  • Suggested answer
    Charles Ray Profile Picture
    Charles Ray on at
    RE: SQL Insert permission being denied on external database using GP user accounts

    Could it be failing since the GP users and passwords are encrypted?  You might want to try creating a non-GP user and give it public/datareader/datawriter in both databases.

  • Suggested answer
    Almas Mahfooz Profile Picture
    Almas Mahfooz 11,006 User Group Leader on at
    RE: SQL Insert permission being denied on external database using GP user accounts

    For similar kind of work, I did below.

    1. create login for each gp user in external database with CREATE USER 'userid' FROM LOGIN 'gp user login' .

    2.  Exec sp_addrolemember db_datawriter, 'userid'

    3. Exec sp_addrolemember db_datareader, 'userid'

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,407 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans