Article ID: 205415
Article Last Modified on 10/3/2003
//extern "C"{
#include <srv.h>
//}
To read:
extern "C"{
#include <srv.h>
}
The project should now compile with out any errors. To run the extended stored procedure, follow these steps:
"c:\simpXP\debug\simpXP.dll"NOTE: The whole path and name must conform to the 8.3 naming conventions for SQL Server.
--********************************************** sp_dropextendedproc xp_Easy GO sp_addextendedproc xp_Easy, "c:\simpXP\debug\simpXP.dll" GO Execute xp_Easy --**********************************************The output should look like:
"This is how easy XP's can be!"
//************************************************
#define DBNTWIN32
#include <windows.h>
#include <sqlfront.h>
#include <sqldb.h>
//extern "C"{
#include <srv.h>
//}
#define XP_NOERROR 0
#define SRV_MAXERROR 20000
#define CMDSHELL_ERROR SRV_MAXERROR + 2
int xp_Easy(SRV_PROC * srvproc)
{
srv_sendmsg(srvproc, SRV_MSG_INFO , CMDSHELL_ERROR, SRV_INFO, (DBTINYINT)0,
NULL, 0, 0, "This is how easy XP's can be!", SRV_NULLTERM);
srv_senddone(srvproc, SRV_DONE_MORE, 0, 0);
return(XP_NOERROR);
}//end
//************************************************
LIBRARY xp_Easy
DESCRIPTION 'SQL Server Extended Stored Procedure - DLL'
EXPORTS
xp_Easy
Additional query words: hello world simple
Keywords: kbhowto KB205415