SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 generate a function from c code.
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mathmax
Yak Posting Veteran

France
95 Posts

Posted - 07/16/2008 :  21:51:03  Show Profile  Reply with Quote
Hello,

I've a function written in c that takes about thousands lines of code. I have to implement the same function as a scalar valued function on SQL Server.
Is there a way to generate a SQL server function from .c code?
In Visual Studio, there is a project called "Database Project" that allow to do this from c# or vb code but I don't find the equivalent project from c/c++...

Thank you in advance for any help,

regards,

mathmax

rmiao
Flowing Fount of Yak Knowledge

USA
7266 Posts

Posted - 07/16/2008 :  23:32:54  Show Profile  Reply with Quote
Take look at clr if it's for sql2k5.
Go to Top of Page

mathmax
Yak Posting Veteran

France
95 Posts

Posted - 07/16/2008 :  23:40:03  Show Profile  Reply with Quote
Could you explain? I'm quite novice and I don't understand what I should look.
Go to Top of Page

rmiao
Flowing Fount of Yak Knowledge

USA
7266 Posts

Posted - 07/16/2008 :  23:42:12  Show Profile  Reply with Quote
Just search CLR in books online, there are samples.
Go to Top of Page

mathmax
Yak Posting Veteran

France
95 Posts

Posted - 07/16/2008 :  23:50:19  Show Profile  Reply with Quote
Here http://msdn.microsoft.com/en-us/library/ms131043.aspx, they say :
Managed Visual C++ database objects that have been compiled with the /clr:pure Visual C++ compiler option are not supported for execution on SQL Server 2005. For example, such database objects include scalar-valued functions.

I suppose it's the same for C functions, isn't ?

Maybe I could call a C-compiled function of a .dll from c# code via the interoperability (DllImport) ?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

Sweden
30108 Posts

Posted - 07/17/2008 :  02:02:29  Show Profile  Visit SwePeso's Homepage  Reply with Quote
What kind of function could ever be "thousands of lines"?


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

mathmax
Yak Posting Veteran

France
95 Posts

Posted - 07/17/2008 :  08:32:02  Show Profile  Reply with Quote
A function from the CA-clipper language that I have to implement on the server side. It takes two parameters. An expression and a formatting string and return a formatted expression. The formatting string possibilities can be infinity : it's a composition of several action to apply either on a character or on the whole string.

What about this sentence :
Managed Visual C++ database objects that have been compiled with the /clr:pure Visual C++ compiler option are not supported for execution on SQL Server 2005. For example, such database objects include scalar-valued functions.

It's not possible to reuse the c code via the clr ?
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000