Installation is trivial; simply download the file dbscript.exe and place it somewhere on your file system.


Create a script using notepad or any other plain text editor. Invoke it via the command
dbscript.exe scriptname



dbscript accepts the following symbols as comment indicators:
  • #
  • '
  • --
  • //

Comments will run to the end of the line; ie dbscript will ignore everything it sees following a comment indicator until the end of that line.

sqlserver command

The sqlserver command identifies the name and connection details of the SQL Server to be used. The parameters to this command can be in any order. The parameters are all optional.
  • username database user name
  • password database password
  • database database name to use

In a future version this command will be expanded to use ODBC DSNs, non-SQL Server databases, encrypted passwords, and registry-stored usernames and passwords.

query command

The query command executes an SQL statement and generates an implicit Excel spreadsheet from its results. The command can be any valid SQL statement though logically only commands which return a result are meaningful.

The command requires a non-optional text string parameter.

In the first release, dbscript will take a single string (which may wrap over multiple lines but without any line break.) In subsequent releases multi-line strings will be supported as well as loading SQL queries from text files.

mailserver command

The mailserver command simply identifies the SMTP server to use. The non-optional parameter identifies the name of the mail server.

Future dbscript releases will include support for authentication.

mail command

The mail command e-mails the generated Excel spreadsheet as an e-mail attachment.

The e-mail address to send to is a non-optional parameter.

Other parameters are
  • subject text string to be used as subject line

Future versions of dbscript will include support for CC, BCC and message body fields.

Last edited Nov 17, 2012 at 2:11 AM by davidmwilliams, version 1


No comments yet.