Execute T-SQL queries against a database and view or save the results. Just place your .sql files in the Scripts folder with all of your other scripts, and you can run them like any other type of supported script file (although you can't supply parameters). Query commands follow a similar syntax to all other wsubi commands, but require a few additional parameters:
  • [~wsubi]: query script.sql [query_type] [outputs_to] [connection_string]
    • [query_type] - What type of query you are attempting to execute. Options are:
      • value - Use this for scalar queries where you just want a single value returned.
      • row - Use this when you want a single row of values returned.
      • rowset - Use this to return a dataset with many rows.
      • nonquery - Use this to execute commands where you don't expect any return data.
    • [outputs_to] - How you would like the query results to be displayed. Options are: screen or file. If you choose file, the file will be created in the same directory where 'wsubi.exe' resides.
    • [connection_string] - Just a typical SQL Server connection string.
  • Sample: [~wsubi]: query select_single.sql value screen Server=.\SQLEXPRESS;Database=AdventureWorks2008;Trusted_Connection=True;

Last edited Nov 29, 2013 at 7:10 PM by bryanoconnell, version 5


No comments yet.