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

XP_NET_ADDNAME

Before we describe this function we must first explain what is known as a “NetBIOS Message Alias”. If you are familiar with sockets programming then you can think of it as an end point e.g. Port 80 on machine X. In NetBIOS, a simple string of up to 15 characters identifies these end points. By default a number of these message aliases will already be defined by Windows as it starts up. Normally you will have the current user, the current machine and the current domain or workgroup. You can see all the currently defined names by issuing the following from a command prompt: “nbtstat –N”. To add a name using the command line, you can use “NET NAME NameToAdd /ADD”. Allowing you to add new names to the list will allow you to customize the “From” parameter of XP_NET_SEND which is described later. This XP takes a single string parameter, which is the name of the message alias to add. The underlying SDK function used in this XP is “NetMessageNameAdd”. Because this function only accepts UNICODE strings, we use the XP_PT_UNICODETEXT and XP_UNICODETEXT macros supplied by the XP++ framework to handle the Unicode string manipulation. The following code snippet shows how we declare the 1 input string parameter for this XP and then obtain this parameter as a UNICODE string prior to using it in the call to “NetMessageNameDel”:

BEGIN_IMPLEMENT_XP_PARAMETERS(CNetAddNameExtendedStoredProcedure)
XP_INPUT_PARAMETER(1, NULL, XP_ALLOW_BIGVARCHAR | XP_ALLOW_BIGCHAR | XP_ALLOW_TEXT | XP_ALLOW_VARCHAR | XP_ALLOW_NTEXT | XP_ALLOW_NVARCHAR, FALSE, FALSE, XP_PT_UNICODETEXT)
END_IMPLEMENT_XP_PARAMETERS(CNetAddNameExtendedStoredProcedure)

BOOL CNetAddNameExtendedStoredProcedure::Run()
{
//Validate our parameters
XP_ASSERT(m_pParameterData);

//Get the parameters
wchar_t* pszMessageName = XP_UNICODETEXT(m_pParameterData[ADD_MESSAGE_NAME_INDEX].m_Data);
XP_ASSERT(pszMessageName);
.
.
.


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