Call now: (800) 766-1884  


 SQL Server Tips
 SQL Server Training

 SQL Server Consulting
 SQL Server Support
 SQL Server Remote DBA

 SQL Server Scripts
 Scripts Menu




  SQL Server Tips by Gama and Naughter

.NET vs. XPís

In terms of performance, for heavy-duty algorithms, XP's will always outperform .NET code because native code is faster than CLI code and there is also a lower overhead. However, when an algorithm is somewhat complex and requires access to data from the database for its calculations, .NET code might be faster than TSQL accessing the data and an XP doing the number crunching. It is possible to use an XP for accessing the data through ODBC but this is a more demanding and harder to maintain solution.
Some applications that use COM with TSQL and SP_OA* procedures should not be modified if the COM object is used very seldom or use XP_RUNSCRIPT otherwise. Using .NET objects to wrap COM would add too much overhead.

XPís can run on SQL Server 2005 but it cannot use the new data types: VARCHAR(MAX), NVARCHAR(MAX), VARBINARY(MAX) and XML.

The new MAX keyword makes using blobs easier by defining variables with length up to 2 Gb with no pointers involved. The text, ntext and image data types are obsolete. The XML data type has features for storing data in XML format and using XPath expressions directly in TSQL. Other interesting features are tabular and recursive queries.

The right choice

Each language has pros and cons and using each one for what it is best at, while considering the specific needs of the application, should lead to the best results. This is very clear because TSQL is tightly integrated with the database engine, .NET database objects are tightly integrated with the .NET environment and XPís are tightly integrated with the windows core.

The above book excerpt is from:

Super SQL Server Systems
Turbocharge Database Performance with C++ External Procedures

ISBN: 0-9761573-2-2
Joseph Gama, P. J. Naughter


Burleson Consulting Remote DB Administration







Burleson is the America's Team

Note: The pages on this site were created as a support and training reference for use by our staff of DBA consultants.  If you find it confusing, please exit this page.

Errata?  SQL Server technology is changing and we strive to update our SQL Server support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:and include the URL for the page.

Burleson Consulting
SQL Server database support


Copyright © 1996 -  2013 by Vaaltech Web Services. All rights reserved.

Hit Counter