none
powershell script to CLR RRS feed

  • Question

  • i have a powershell script that returns data in format-table format.

    Now I wanted to convert the powershell script to CLR and that CLR function I will be using it to SQL Server to return results.

    How to do the same ?

    Thanks,

    Ganesh


    Ganesh

    Wednesday, April 3, 2019 8:35 PM

Answers

All replies

  • You will have to post questions on writing CLR code in whatever language you are referring to.

    For the record. PowerShell is already based on CLR. PowerShell can query SQLServer without any special considerations.

    help invoke-sqlcmd -full


    \_(ツ)_/

    Wednesday, April 3, 2019 9:01 PM
  • Is there a way I can convert a .ps1 file to distribute as a CLR ?


    Ganesh

    Wednesday, April 3, 2019 9:04 PM
  • Is there a way I can convert a .ps1 file to distribute as a CLR ?


    Ganesh

    What is a CLR.  It seems you have heard about CLR but you do not know what it is.  Start by looking up CLR and learning what it is.

    Here is a good place to start: https://en.wikipedia.org/wiki/Common_Language_Runtime

    Once you understand this you will be able to ask a question that makes sense.


    \_(ツ)_/

    Wednesday, April 3, 2019 9:08 PM
  • Yes you are right, I am not fully aware of CLR. I think my question do not make sense.

    https://documentation.red-gate.com/pages/viewpage.action?pageId=54822477

    The above link is an example of creating an C# class library project to convert as an CLR.

    Is there a way a .ps1 function can be converted to a clr function and thus can be called from T-sql is my original question.


    Ganesh

    Wednesday, April 3, 2019 9:22 PM
  • You cannot create a C# class library from PowerShell script.


    \_(ツ)_/

    • Marked as answer by Ganesh Babu Wednesday, April 3, 2019 10:47 PM
    Wednesday, April 3, 2019 9:57 PM