Questions That Should Be Asked More Frequently

Q

Given a scenario that could be solved with either T-SQL or the SQL CLR, how should I determine which to use?

A

The best advice I can offer is this: when in doubt, write some proof-of-concept code, test it in an environment that will approximate the desired scenario, and see what happens. Take the prime-number-generating stored procedure as an example. For small sets of numbers, I expected that the two approaches would yield similar performance numbers and that the overhead of switching to the SQL CLR would be roughly equivalent to the overhead of creating the temporary table. For larger sets of numbers, I expected that the SQL CLR could would be more efficient. I further expected that as the size of ...

Get Programming Microsoft® ADO.NET 2.0 Core Reference, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.