Should I deploy my C# code to a SQL Server 2005 stored procedure?


I think one of the criteria is: Will this make SQL Server cluster consume less resources (CPU, Memory, Network bandwith, ...) to have the C# code inside the database or outside the database?


The reason is that in a typical Web infrastructure where you have a SQL cluster that does not scale out as easily as the other servers (like web servers in the farm), the SQL cluster is the most precious part of the infrastructure.


In a scenario where you have data set operations, like calculating a surface with points stored in the DB, having C# code inside the database is better, because it will cost less to the SQL Server to process calculation inside the DB and not have the whole data transmitted to the Web or calculation Servers.
On the other hand, if you need to do expensive calculations on few data, please do it outside the database.


Another criterion is to avoid having SQL Server connect elsewhere. Typical architectures have most servers connect to SQL Server and SQL Server connect to nearly nothing (just an SMTP server, and maybe some external OLE DB data sources).

Comments (1)

Comments are closed.

Skip to main content