Store PowerShell objects in SQL Server 2012 dbms

Tagged: 

This topic contains 4 replies, has 2 voices, and was last updated by Profile photo of CHARALABOS CHARALABOS 6 months, 1 week ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #36756
    Profile photo of CHARALABOS
    CHARALABOS
    Participant

    Hello community,
    Could you please guide me where to find information about how can I use SQL Server Express 2012 to store PowerShell objects?

    Until now I use the instructions of the book "Learn PowerShell Toolmaking in a Month of Lunches" that simply connect to a database and store information in tables.

    I want to go one step forward and learn how to store PowerShell objects as SQL objects.

    Is there any module or script for this to be done?
    Or any advise?

    Thanks in advance
    CV

    #36760
    Profile photo of Arie H
    Arie H
    Participant

    What Objects are you looking to save in SQL?

    Are you reffering to XML structure or JSON ?

    If others, why would you want to flatten objects into 2D tables ?

    I can understand saving data to SQL and having a ps script query the data and do something with it.But then its data, not PS objects. Remember that a DB table isnt always the best sotrage for all operations, sometimes a text file / ini file would be easier.

    #36761
    Profile photo of CHARALABOS
    CHARALABOS
    Participant

    Thank you for the quick reply.
    I need to store custom objects that will contain basically some string and datetime properties.
    In fact you helped me by referring to XML or JSON.
    Is it possible to store json in SQL server 2012 db?

    Furthermore it is mandatory to use SQL server (referring to the alternative way of storing data).
    Thanks

    #36765
    Profile photo of Arie H
    Arie H
    Participant

    You can store any info you want in SQL, the structre is not "important". You can store pictures for that matter

    that said, SQL2012 supports XML as a native datatype, so you can have a table with a column that is an XML document. As it's natively supported it means you can even do a select statement to find a specif value down the tree on the SQL itself, without needing to send the XML to the client and let it parse it.

    In SQL 2016 JSON will be supported "almost" natively

    #36767
    Profile photo of CHARALABOS
    CHARALABOS
    Participant

    Thank you again for the reply.
    Honestly you helped me a lot.
    Now it only remains to make some tests.

    Thanks again

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.