Kuzgun
Kuzgun

Reputation: 4737

Does using C# CLR have any advantages over C# application?

I do some utility works to update databases which are simply gathering data from some websites and web services, and update related rows of database continously. I wrote an application on C# to do this. It is my bad, but I heard about using CLR for the first time today and googled it to make some research. I found many articles on comparing CLR with T-SQL but couldn't find much about difference between using CLR on SQL server and a normal application which connects to SQL server. Is it wise to use CLR on such utility occasions?

Edit: To make the question more clear, I wonder about comparison between using C# inside SQL Server and using C# as a main application, querying SQL server.

Upvotes: 1

Views: 289

Answers (2)

usr
usr

Reputation: 171178

You describe an application that seems to be a webcrawler (or similar). That does not sound at all like a good fit for SQL CLR. Performance-wise, SQL CLR helps you by removing network roundtrips and network transfers, basically. The performance of a web crawler would not at all depend on the network latency to the database.

I think you should investigate general performance tuning techniques for SQL Server. Get your schema and indexes right. Use efficient queries. Don't be too chatty on the network.

I certainly would not want my SQL Server instance to issue HTTP requests to foreign web servers... That seems like a reliability killer and possibly a security problem.

Upvotes: 1

Tigran
Tigran

Reputation: 62246

The only benefit known to me of using C# like a core language for stored procedure on latest versions of SQL Server, is a

  • can write more complex logic, as C# language permits that
  • do not need to learn a new language (SQL)

Upvotes: 0

Related Questions