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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T23:42:55+00:00 2026-06-16T23:42:55+00:00

I have created a user defined function in .NET 2.0 and am able to

  • 0

I have created a user defined function in .NET 2.0 and am able to successfully deploy it to my local SQL Server instance. However, I need to grant a specific user EXECUTE permission on the function. I want this to be done in the CLR method itself so that I don’t have to manually re-grant the permission every time I redeploy the UDF. Deploying the CLR function from Visual Studio generates this function in the database:

ALTER FUNCTION [dbo].[MyFunction](@input [nvarchar](max))
RETURNS [nvarchar](max) WITH EXECUTE AS CALLER
AS 
EXTERNAL NAME [LibName].[UserDefinedFunctions].[MyFunction]
GO

Is there a way I can have it tack this on:

GRANT EXECUTE ON [dbo].[MyFunction] TO [wwwUser] AS [dbo]

Thanks.

  • 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-06-16T23:42:56+00:00Added an answer on June 16, 2026 at 11:42 pm

    Yes – see MSDN – you just create a script called PostDeployScript.sql in your project at the root and it gets automagically appended to the build output.

    Note that in VS2012, the Add… dialog has an option to add a script of type “Script (PostDeployment)” or similar – but it then adds the customary “1” to the filename, and that then doesn’t work. I’ve not bothered looking further, although it is also mentioned in MSDN, because the first method just works.

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

Sidebar

Related Questions

Actually I have created a User defined table type in sql server 2008. Structure
I have created following stored user defined it gets executed successfully. CREATE FUNCTION spherical_distance1(@a
I have created one user named tuser with create database rights in SQL server
I have created a user defined function to determine whether cells are highlighted a
I have created a user defined function to gain performance with queries containing 'WHERE
I have created user-defined function that converts a comma-delimited string into a table. I
I have this problem whereby, i have created a user defined function within php.
I am trying to make a user defined function that returns nothing. I have
I have created a CLR in a SQL server 2005 database. It is a
I have created a user defined type to contain some data that I will

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.