Common Database Connection String ( Powershell)

Welcome Forums General PowerShell Q&A Common Database Connection String ( Powershell)

This topic contains 2 replies, has 2 voices, and was last updated by

4 years, 11 months ago.

  • Author
  • #15465

    Topics: 1
    Replies: 1
    Points: 0
    Rank: Member


    I have requirement to create common connection string to execute all SQL script file or Query and i could not find any example.

    Please could you help me get an example or provide some input based on your experience.

    This will help to achieve my tasks ..!

    using power shell v2.0


  • #15466

    Topics: 5
    Replies: 16
    Points: 21
    Rank: Member

    Hi, is it the actual connection string you need help with or how to conect to the database and get data?

    If you want to have a connectionstring available for all your scripts you can add the connection string to your $PROFILE. That ensures that is is available for your scripts.

    Don Jones have a great example for how you can do this in his code for generating historical reports. The code is available from the OneDrive folder.

  • #15468

    Topics: 1
    Replies: 1
    Points: 0
    Rank: Member

    Hi joakim,

    Thank you so much for your quick reply.

    Hers's the steps i would like to connect database :-

    1. Create common script, should have only the connections string info like user/pwd & server & database name with encrypted PWD.

    2. Create .ps1 script to call the connection string and then open connection to execute the QUERY or procedure / .sql file

    3. close the connection sting in the .ps1 file

    4. Done

The topic ‘Common Database Connection String ( Powershell)’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort