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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:46:57+00:00 2026-05-22T20:46:57+00:00

Is there a way to change the code of CLR procedure in SQL Server

  • 0

Is there a way to change the code of CLR procedure in SQL Server dynamically?

Suppose you have an assembly with your business logic deployed in MS SQL Server 2008 R2. This assembly (or assemblies) is being used constantly (for example calling some functions for each row of a table in multiple concurrent queries). So you cannot just drop assembly. Is there a way to change my business logic dynamicly or some way to execute external changable code?

I’ve already explored these approaches, but none worked:

  1. Reflection.Emit
  2. Mono.Cecil
  3. Loading external assembly in the assembly deployed in SQL Server

UPDATE:
The question was not about release process: I want to be able to set some security rules dynamically via GUI.

For instance some users should be able to see only clients without their addresses or the transactions within the last year and so on.

The rules are not complicated but they may change almost every day and we cannot put them in the code. The rest of the business logic is implemented in TSQL. CLR was chosen because of the performance issue (dynamic SQL is too slow).

There was another option: generate clustered views (with rules in WHERE section) but it was not quick enough.

Some more details:

Suppose we have some code selecting a part of big table dbo.Transactions

select *
from dbo.Transactions
where ... --filters from your business logic

If we want to filter the result to show allowed rows we could generate some indexed view and join it with the result set like this:

select *
from dbo.Transactions t
inner join dbo.vw_Transactions v
on t.id = v.id
where ... --filters from your business logic

But if we check the execution plan in most cases the query analyzer decides not to filter dbo.Transaction and then join with vw_Transactions, but to join first and filter later (which is absolutely not desirable). Hints like FORCE ORDER doesn’t help.

  • 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-22T20:46:58+00:00Added an answer on May 22, 2026 at 8:46 pm

    There’s a good library for dynamic evaluating arithmetic expression (with parameters) – Flee

    In my case I didn’t have to execute any .Net code – just the expressions like “Date > ‘20100101’ Or Status = 2”, so Flee satisfies almost completely. The only issue is that its logical operators don’t work with SqlBoolean type (which is used in sql expressions) but it’s not a big deal to add this feature.

    But in general case it’s seems to be impossible to execute dynamic .Net code inside Sql Server host.

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

Sidebar

Related Questions

Is there a way to change a WPF assembly icon from code? I'm not
Is there any way that I can change how a Literal of a code
Is there any way I can change this code so I can remove the
Is there any way to change indentation style for automatically generated code in Eclipse?
Is there any way to change the source code of servlets/JSPs directly on the
Is there a way to change the code generated by a quick-fix in Resharper?
Is there any way to change how XCode compiles my code without completely reprogramming
Is there a way to change the pathname in the source code (browsers)? http://my.domain.com/pathname/cms/wp-content/themes/themename/example/example.js
Is there a way to change the defaults within a plugin after they have
Is there a way to change python2.x source code to python 3.x manually. I

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.