Call now: (800) 766-1884  



 Home


 SQL Server Tips
 SQL Server Training

 SQL Server Consulting
 SQL Server Support
 SQL Server Remote DBA



 Articles
 Services
 SQL Server Scripts
 Scripts Menu



 

 

 

   
  SQL Server Tips by Gama and Naughter

Precompiled headers

To speed up compilation time it is often a good idea to precompile big chunks of code that change seldom or include files that are common to several different modules. The first compilation process to create the precompiled headers might be slow but, once it is done, the compilation of the entire project will be faster.

It is a standard method to use the stdafx.h header file for setting up precompiled headers by specifying in the project that a precompiled header file (pch) will be created for this header file. The remaining header files will use the same precompiled header file. This is done by going to project settings, clicking on a .cpp file and under the C/C++ tab selecting "precompiled headers" from the "category" dropdown; from there it is a matter of selecting one of the options to handle precompiled headers.

An alternative to use the project settings is to define an include statement:

#include "stdafx.h"
#pragma hdrstop


By default, the XP wizard selects all precompiled headers' options as "Automatic use of precompiled headers" but it is better to create a precompiled header file for stdafx.h and use a precompiled header file for the rest because Automatic Precompiling allows the compiler to decide when to create and use precompiled headers. This is fine but in many cases but it will not work when the precompiled header files are not included in the same order for all source files in the project. That is when creating a precompiled header file for stdafx.h is used but it might as well be used as a general solution.

xp_hello2, Input parameter, output in the message window
After examining how to return some output from XPís, it is time to look into the input.

An XP can have both input and output parameters, the latter are followed by the keyword OUTPUT or its short equivalent OUT. All input parameters must be validated by the code, which is more complicated than the code already seen for returning the output. This is due to the fact that there is plenty of control over the output but not over the input because of the many aspects to consider: security, data type issues, error management, etc.


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

 http://www.rampant-books.com/book_2005_2_sql_server_external_procedures.htm  

 

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