none
SQLCMD and load instance_list from separated file RRS feed

  • Dotaz

  • Hello,

    I have 2 files:
    1. file: ACL.sql script in SQL
    2. file .: instances_list.txt, where I have a listing of SQL instances where I want to apply ACL.sql

    I need to use SQLCMD to load instances from instancelist.txt and apply ACL.sql

    Will you help me, please?

    Mark__Fox

    úterý 24. září 2019 13:58

Všechny reakce

  • wrap it around with for loop /script such as for /f %i in (instances.txt) do sqlcmd.exe -S %i ...

    MP

    P.S. pis cesky sem, nebo EN do EN for

    úterý 1. října 2019 7:30
  • FOR /F "tokens=1 delims=," %%G IN (dblist.csv) DO FOR /F "tokens=1 delims=," %%G IN (dblist.csv) DO SQLCMD -S %%G -i "acl.sql" -m 12 -E -o "protocol_output.txt"

    How do I make a change, but the protocol (-o  "protocol_output.txt") has grown (=> appending)?

    pondělí 7. října 2019 13:18
  • either use >> instead of -o, or just make log filename unique ( -o "protocol_output_%%G.txt")

    MP

    úterý 8. října 2019 10:16