Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

sql assemblies in .net Expand / Collapse
Author
Message
Posted Thursday, June 26, 2008 4:17 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Friday, March 12, 2010 3:15 AM
Points: 66, Visits: 78
i have created an assembly in sql server. written stored procedures ,triggers and a function to it now tell me how can I use this assembly in VB.net to view the records or results.

I tried it by using the same method as we follow for private assembly but it gives
---------------------------------
Imports SqlServerProject2

Dim o As StoredProcedures

StoredProcedures.PrintDate()
----------------------------------------
an error occurs :-"The requested operation requires a SqlClr context, which is only available when running in the Sql Server process."

how to resolve this?
Post #523988
Posted Thursday, June 26, 2008 10:26 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Thursday, November 20, 2014 10:24 AM
Points: 1,865, Visits: 3,620
The purpose of a SQLCLR assembly is for it to be invoked from within SQL code.

You don't need to call it from .NET code.

What is your assembly doing?


__________________________________________________________________________________

Turbocharge Your Database Maintenance With Service Broker: Part 2
Turbocharge Your Database Maintenance With Service Broker: Part 1
Real-Time Tracking of Tempdb Utilization Through Reporting Services
Monitoring Database Blocking Through SCOM 2007 Custom Rules and Alerts
Preparing for the Unthinkable - a Disaster/Recovery Implementation
Post #524377
Posted Thursday, June 26, 2008 7:49 PM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: Thursday, December 4, 2014 7:52 AM
Points: 9,294, Visits: 9,495
Make a common library that you can call both from your SQLCLR wrapper and from VB.net.

-- RBarryYoung, (302)375-0451 blog: MovingSQL.com, Twitter: @RBarryYoung
Proactive Performance Solutions, Inc.
"Performance is our middle name."
Post #524689
Posted Thursday, June 26, 2008 11:07 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Friday, March 12, 2010 3:15 AM
Points: 66, Visits: 78
how to use this assembly in .net then
Post #524764
Posted Friday, June 27, 2008 8:17 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, November 3, 2014 2:42 PM
Points: 1,683, Visits: 1,798
If you want to use the Logic from a CLR Stored Procedure outside of SQL Server, you need to code it for such a purpose. I generally abstract the logic portions that may be used outside of SQL Server into traditional methods and call out to those in SQL and in the application. The SqlPipe and SqlContext don't exist outside of SQL Server, so you have to code a test for them in your CLR code so that it functions properly if it is being run outside of SQL Server.

Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
My Blog | Twitter | MVP Profile
Training | Consulting | Become a SQLskills Insider
Troubleshooting SQL Server: A Guide for Accidental DBAs
Post #525408
Posted Saturday, June 28, 2008 7:10 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Thursday, November 20, 2014 10:24 AM
Points: 1,865, Visits: 3,620
For the purposes of this debate, what is the point of invoking SQLCLR code outside a SQL context?
I'm wondering if this is even necessary.

What are the possible scenarios for this? If the SQLCLR assembly is accessing environmental resources (O/S, registry, event logs etc.) why can't this be done from the .NET code without using the SQLCLR? If not, what is the assembly doing?

Pls everybody, humor me on this, am I missing something?


__________________________________________________________________________________

Turbocharge Your Database Maintenance With Service Broker: Part 2
Turbocharge Your Database Maintenance With Service Broker: Part 1
Real-Time Tracking of Tempdb Utilization Through Reporting Services
Monitoring Database Blocking Through SCOM 2007 Custom Rules and Alerts
Preparing for the Unthinkable - a Disaster/Recovery Implementation
Post #525480
Posted Saturday, June 28, 2008 8:20 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, November 3, 2014 2:42 PM
Points: 1,683, Visits: 1,798
More thn anything else, UDT's and UDF's are easily used out side of SQL. This is of great benefit for things like geocoding where the UDT is used as a typed object in the app as well. SQL 2008 implements the spatial datatypes in this manner. You can download the SDK online.

Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
My Blog | Twitter | MVP Profile
Training | Consulting | Become a SQLskills Insider
Troubleshooting SQL Server: A Guide for Accidental DBAs
Post #525487
Posted Saturday, June 28, 2008 11:55 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Thursday, November 20, 2014 10:24 AM
Points: 1,865, Visits: 3,620
Jonathan Kehayias (6/28/2008)
More thn anything else, UDT's and UDF's are easily used out side of SQL. This is of great benefit for things like geocoding where the UDT is used as a typed object in the app as well. SQL 2008 implements the spatial datatypes in this manner. You can download the SDK online.


Thank you, that I didn't know...


__________________________________________________________________________________

Turbocharge Your Database Maintenance With Service Broker: Part 2
Turbocharge Your Database Maintenance With Service Broker: Part 1
Real-Time Tracking of Tempdb Utilization Through Reporting Services
Monitoring Database Blocking Through SCOM 2007 Custom Rules and Alerts
Preparing for the Unthinkable - a Disaster/Recovery Implementation
Post #525524
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse