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 xxx

SQL Server Tips by Gama and Naughter Consulting



To hide the details of the various ellipsoid models, which are in operation, the code stores the ellipsoid details in a static array, which other XP functions can then simply reference by a numeric id. The values stored in this array are defined as follows:

struct CReferenceEllipsoid
char* Name;
double EquatorialRadius;
double OneOverF;

The “Name” value is simply how it is known as e.g. “Airy 1830”. Normally the names contain the cartographer involved and a year when the work was done. The “EquatorialRadius” value is the radius of the ellipsoid at the equator measured in metres. In mathematical equations this value is commonly referred to by “a”. The “OneOverF” is the reciprocal of the flattening of the ellipse. This is a measure of how much the ellipse differs from a circle in cross section. A value of 0 for the flattening, which is commonly referred to by “f”, would define a circle, while 1 would define a completely flat ellipse. The code contains twenty-eight ellipsoid definitions ranging from ellipses defined in the early nineteenth century right up to the ellipse definition in use by the GPS ring of satellites. The list of ellipsoids is based on the listing provided by Peter H. Dana at

This XP allows TSQL script to easily enumerate and access these values, rather than hard code these numerical constants in TSQL. This XP takes one input parameter, which is the numeric id of the ellipsoid details to obtain, and three output parameters. The various ID’s are defined by an enumeration in the code, which you can use as a reference:

enum ReferenceEllipsoid
AIRY_1830 = 0,
BESSEL_1841 = 4,
CLARKE_1866 = 5,
CLARKE_1880 = 6,
FISCHER_1968 = 14,
HELMERT_1906 = 15,
HOUGH_1960 = 16,
INDONESIAN_1974 = 17,
KRASSOVSKY_1940 = 19,
GRS_1967 = 20,
GRS_80 = 21,
WGS_60 = 23,
WGS_66 = 24,
WGS_72 = 25,
WGS_84 = 26,
IAU_1976 = 27

Upon return from this XP, the first output parameter will contain the name of the ellipsoid, the second will contain the equatorial radius in metres and the final output parameter will contain the reciprocal of the flattening. This XP provides a very simply example on how an inbuilt database of information could be stored in an XP. An alternative implementation would be to store these values in a real table in the database and pass these values to the other XP’s in this DLL. Both approaches are equally valid. In this implementation, it was decided to hide these details in the DLL.

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