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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:24:03+00:00 2026-05-15T01:24:03+00:00

In short – is it a good design solution to implement most of the

  • 0

In short – is it a good design solution to implement most of the business logic in CLR stored procedures?

I have read much about them recently but I can’t figure out when they should be used, what are the best practices, are they good enough or not.

For example, my business application needs to

  • parse a large fixed-length text file,
  • extract some numbers from each line in the file,
  • according to these numbers apply some complex business rules (involving regex matching, pattern matching against data from many tables in the database and such),
  • and as a result of this calculation update records in the database.

There is also a GUI for the user to select the file, view the results, etc.

This application seems to be a good candidate to implement the classic 3-tier architecture: the Data Layer, the Logic Layer, and the GUI layer.

  • The Data Layer would access the database
  • The Logic Layer would run as a WCF service and implement the business rules, interacting with the Data Layer
  • The GUI Layer would be a means of communication between the Logic Layer and the User.

Now, thinking of this design, I can see that most of the business rules may be implemented in a SQL CLR and stored in SQL Server. I might store all my raw data in the database, run the processing there, and get the results. I see some advantages and disadvantages of this solution:

Pros:

  • The business logic runs close to the data, meaning less network traffic.
  • Process all data at once, possibly utilizing parallelizm and optimal execution plan.

Cons:

  • Scattering of the business logic: some part is here, some part is there.
  • Questionable design solution, may encounter unknown problems.
  • Difficult to implement a progress indicator for the processing task.

I would like to hear all your opinions about SQL CLR. Does anybody use it in production? Are there any problems with such design? Is it a good thing?

  • 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-15T01:24:03+00:00Added an answer on May 15, 2026 at 1:24 am

    I do not do it – CLR ins SQL Server is great for many things (calculating hashes, do string manipulation that SQL just sucks in, regex to validate field values etc.), but complex logic, IMHO, has no business in the database.

    It is a single point of performance problems and also VERY expensive to scale up. Plus, either I put it all in there, or – well – I have a serious problem maintenance wise.

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

Sidebar

Related Questions

Short story: stopPropagation() prevents a dropdown menu from closing - which is good. But
Short background, I have a device I connect to via HyperTerminal to receive information
Short Intro Currently I have a UITableView which is filled with custom cells that
Short Version: I have 7 SSISDeploymentManifest files I need to run. Is there a
Short Working on login system and trying to implement remember me feature. Recently, l
Short version of the question: If you have a table with a large number
Short Question I have a loop that runs 180,000 times. At the end of
Short of putting a UIWebView as the back-most layer in my nib file, how
Short Version Is there a way to have visually represented user re-sizable data ranges
Short Description I have to run Ghostscript on AIX. It works in command line

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.