Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Access to the code in the CLR Stored Procedures


Access to the code in the CLR Stored Procedures

Author
Message
AER
AER
Mr or Mrs. 500
Mr or Mrs. 500 (528 reputation)Mr or Mrs. 500 (528 reputation)Mr or Mrs. 500 (528 reputation)Mr or Mrs. 500 (528 reputation)Mr or Mrs. 500 (528 reputation)Mr or Mrs. 500 (528 reputation)Mr or Mrs. 500 (528 reputation)Mr or Mrs. 500 (528 reputation)

Group: General Forum Members
Points: 528 Visits: 245
Hi everybody,

I'm a DBA for a Company database; and of course a sysadmin. We have few CLR stored procedures embedded into SQL Server from .NET application.
The modify option is greyed out and the script returns just the name of stored proc and it's parameters.

Is there any way I can view and search inside the entire code in these CLR's within the SSMS?

Your reply is very much appreciated.



Michael Valentine Jones
Michael Valentine Jones
Hall of Fame
Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)

Group: General Forum Members
Points: 3254 Visits: 11771
No, you would need access to the source code repository that was used to build the assembly.
AER
AER
Mr or Mrs. 500
Mr or Mrs. 500 (528 reputation)Mr or Mrs. 500 (528 reputation)Mr or Mrs. 500 (528 reputation)Mr or Mrs. 500 (528 reputation)Mr or Mrs. 500 (528 reputation)Mr or Mrs. 500 (528 reputation)Mr or Mrs. 500 (528 reputation)Mr or Mrs. 500 (528 reputation)

Group: General Forum Members
Points: 528 Visits: 245
It is very frustrating though; since I'm a SQL DB and have no control over these objects in SQL Server.

Did anybody have any luck with other approaches?

Any recommendation if anything I can do about it would be greatly appreciated.



Elliott Whitlow
Elliott Whitlow
SSCertifiable
SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)

Group: General Forum Members
Points: 6208 Visits: 5314
As a matter of policy CLR object source code must be submitted to me prior to deployment. With sufficient lead time to review it. And I have access to the source control system.

Depending on how it was deployed a copy of the source files may have been deployed into the extended properties for the assembly. But this is not for certain and I would not count on it.

Unfortunately SQLCLR is a blackbox from SQL's perspective. So you have to be proactive.

You could probably read the bytes out of the system tables and run them against a decompiler but it wouldn't be pretty.

CEWII
Steve Jones
Steve Jones
SSC-Dedicated
SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)

Group: Administrators
Points: 36107 Visits: 18742
You can try this: http://ask.sqlservercentral.com/questions/71956/getting-the-source-code-from-a-clr-assembly

The compiled code is stored in the system tables. Decompiling it can be tricky. .NET Reflector from Red Gate may help, or another decompiler, but it may or may not be 100%. You'd need to recompile and test to see if it works correctly.

Disclosure: I work for Red Gate

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
AER
AER
Mr or Mrs. 500
Mr or Mrs. 500 (528 reputation)Mr or Mrs. 500 (528 reputation)Mr or Mrs. 500 (528 reputation)Mr or Mrs. 500 (528 reputation)Mr or Mrs. 500 (528 reputation)Mr or Mrs. 500 (528 reputation)Mr or Mrs. 500 (528 reputation)Mr or Mrs. 500 (528 reputation)

Group: General Forum Members
Points: 528 Visits: 245
Thanks a lot for your responds guys,

Steve I will definitely try a .NET Reflector approach from RedGate and let you know how it went.

Thanks again for all your help and cooperation.
Alex



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search