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
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.
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
You must be logged in to reply to this topic.