sql assemblies in .net

  • 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?

  • 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[/url]
    Persisting SQL Server Index-Usage Statistics with MERGE[/url]
    Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]

  • Make a common library that you can call both from your SQLCLR wrapper and from VB.net.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • how to use this assembly in .net then

  • 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[/url]

  • 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[/url]
    Persisting SQL Server Index-Usage Statistics with MERGE[/url]
    Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]

  • 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[/url]

  • 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[/url]
    Persisting SQL Server Index-Usage Statistics with MERGE[/url]
    Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply