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


sql assemblies in .net


sql assemblies in .net

Author
Message
bhakti-sonu
bhakti-sonu
Valued Member
Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)

Group: General Forum Members
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?
Marios Philippopoulos
Marios Philippopoulos
SSCrazy
SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)

Group: General Forum Members
Points: 2550 Visits: 3748
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?

__________________________________________________________________________________
SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables
Persisting SQL Server Index-Usage Statistics with MERGE
Turbocharge Your Database Maintenance With Service Broker: Part 2
RBarryYoung
RBarryYoung
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10140 Visits: 9517
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."
bhakti-sonu
bhakti-sonu
Valued Member
Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)

Group: General Forum Members
Points: 66 Visits: 78
how to use this assembly in .net then
Jonathan Kehayias
Jonathan Kehayias
SSCrazy
SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)

Group: General Forum Members
Points: 2028 Visits: 1807
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
Marios Philippopoulos
Marios Philippopoulos
SSCrazy
SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)

Group: General Forum Members
Points: 2550 Visits: 3748
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?

__________________________________________________________________________________
SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables
Persisting SQL Server Index-Usage Statistics with MERGE
Turbocharge Your Database Maintenance With Service Broker: Part 2
Jonathan Kehayias
Jonathan Kehayias
SSCrazy
SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)

Group: General Forum Members
Points: 2028 Visits: 1807
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
Marios Philippopoulos
Marios Philippopoulos
SSCrazy
SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)

Group: General Forum Members
Points: 2550 Visits: 3748
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...

__________________________________________________________________________________
SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables
Persisting SQL Server Index-Usage Statistics with MERGE
Turbocharge Your Database Maintenance With Service Broker: Part 2
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