May 15, 2008 at 4:47 pm
I am trying to use a CLR procedure inside an import script. I thought it would be easiest to put it in a function so that I wouldn't have to complicate the import script by declaring input and output variables. However, I was confronted by the message "Only functions and extended stored procedures can be executed from within a function."
What I don't understand is why can you use extended stored procedures but not CLR procedures? I am not updating any tables inside the CLR procedure or even using a contextual connection at all.
Can someone please explain the reasoning behind this to me?
May 15, 2008 at 6:25 pm
I have no idea why MS does certain things. 😛
Just curious, what does the CLR do?
--Jeff Moden
Change is inevitable... Change for the better is not.
May 16, 2008 at 3:50 am
I have a library for my application's use in ASP.net (C#) for 2 versions. The library can handle the rather complex conversion already and I would rather use that to migrate the BLOBs data structure in just a few lines than re-write the entire library in T-SQL (and performance is not a big issue for this one time conversion).
May 16, 2008 at 4:41 am
It's probably due to the requirement that functions don't have side effects. It's hard to analyse what the CLR proc does to ensure that there is no way it can have a side effect (same with regular procedures) and so it's forbidden.
Why xps are allowed though is beyond me,
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
May 16, 2008 at 7:47 am
ghelyar (5/16/2008)
I have a library for my application's use in ASP.net (C#) for 2 versions. The library can handle the rather complex conversion already and I would rather use that to migrate the BLOBs data structure in just a few lines than re-write the entire library in T-SQL (and performance is not a big issue for this one time conversion).
Thanks... I'm always interested in how other people do things and why. I really appreciate the feedback.
--Jeff Moden
Change is inevitable... Change for the better is not.
May 23, 2008 at 1:03 pm
ghelyar (5/16/2008)
I have a library for my application's use in ASP.net (C#) for 2 versions. The library can handle the rather complex conversion already and I would rather use that to migrate the BLOBs data structure in just a few lines than re-write the entire library in T-SQL (and performance is not a big issue for this one time conversion).
If your not returning too much data and the shape of your return is not dynamically determined then rewrite your SQLCLR procs into functions. you can calling them within standard T-SQL functions unlike sprocs.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply