Unable to execute SQL script with multiple query and declarations RRS feed

  • Question

  • Hi All,

    I am fairly new to powershell and trying to create some scripts to make my task easier.

    One of the things I need to do is, run SQL Scripts that have multiple queries and functions against multiple database and save the result.

    I tried using invoke-sqlcmd but it seems to only run one query out of the many which has multiple joins.

    Cannot find much help on this, has anyone done script for similar task, or recommended work around.


    Monday, May 7, 2018 2:20 PM

All replies

  • It might help to post a very short example that demonstrates the problem. Even if we don't have the databases, we can see how you run the queries.

    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    Monday, May 7, 2018 2:29 PM