Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 generate a function from c code.

Author  Topic 

mathmax
Yak Posting Veteran

95 Posts

Posted - 2008-07-16 : 21:51:03
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
Master Smack Fu Yak Hacker

7266 Posts

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

mathmax
Yak Posting Veteran

95 Posts

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

rmiao
Master Smack Fu Yak Hacker

7266 Posts

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

mathmax
Yak Posting Veteran

95 Posts

Posted - 2008-07-16 : 23:50:19
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

30421 Posts

Posted - 2008-07-17 : 02:02:29
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

95 Posts

Posted - 2008-07-17 : 08:32:02
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
   

- Advertisement -