Script Hints

Contents

Script Hints#

A script hint instructs SQL Current to use a different connection string when running a database script. This can be very useful for executing database scripts that require different credentials or parameters, such as create and reset scripts.

Example#

When SQL Current runs the following create command, it will use the connString of myserver.

 1server myserver
 2{
 3        driver: 'sqlserver';
 4        connString: 'Server=myserver;user=sandy;Password=sandy;autocommit=1';
 5}
 6
 7database mydb
 8{
 9        driver: 'sqlserver';
10        connString: 'Server=myserver;user=sandy;Password=sandy;autocommit=1;Database=mydb';
11        create: '/create.sql' (myserver);
12}
13
14version 1.0.1
15{
16        apply: '/apply.sql';
17}
18
19create database mydb;

This is useful because the default connection string connString specifies the database, and if that database does not exist then any login to the server will fail. Use a script hint to avoid the problem.

See Also#

Creating Databases