Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SQL Server 2008 R2 / Visual Studio 2010: Writing a stored procedure in managed C++

8 views
Skip to first unread message

Paul

unread,
Feb 1, 2011, 5:25:20 PM2/1/11
to
What is required to write a stored procedure in managed C++?

I have SQL Server 2008 R2 in mind but I note that compared with
version 2005, C++ examples appear to have disappeared from the on-line
documentation for SQL Server 2008. Even if, unlike for VB and C#,
there are no templates for C++ development, still there perhaps is a
way to configure Visual Studio manually. I have pasted an example of a
stored procedure from here:

http://msdn.microsoft.com/en-us/library/zxsa8hkf(v=VS.90).aspx

but cannot build it. First of all, the compiler complains about
#include "stdafx.h" at the top, which I have commented out OK, but
then the code does not link (LINK : fatal error LNK1561: entry point
must be defined). What should the entry point be?

So, the idea is not to call native C++ from within another language
(looks like writing an extended stored procedure is the only way to
use C++ natively which is being deprecated) but use managed C++.

Thank you.

Paul

Paul

unread,
Feb 2, 2011, 8:41:54 AM2/2/11
to
Got it to work.

Created Visual C++ -> CLR -> Class Library project, having
selected .NET Framework 3.5, changed the Common Language Runtime
Support under Configuration Properties to /clr:safe, and was able to
add the compiled assembly DLL to SQL Server, whatever the entry point
was.

#include "stdafx.h" in the example was created by the wizard.

0 new messages