Page 1 of 1

Schedule Task

Posted: Sat Sep 04, 2010 4:49 pm
by Always Learning
Hi There,

I have a couple of questions if you could help please.

Is there a way I can run an SQL Server 2005 script. It need to target a local database and run the script on that database.

Also is there a way to install an .exe and then add a scheduled task refering to the installed .exe

Thanks for your help.

Best Regards,

Re: Schedule Task

Posted: Wed Sep 08, 2010 7:13 am
by Leo
Is there a way I can run an SQL Server 2005 script. It need to target a local database and run the script on that database.
You can run scripts from the command line by using the SQLCMD command line utility and passing it either the script.
In Actual Installer go to System-Command and click Add:

Code: Select all

Command: <SystemDir>\cmd.exe
Parameters: /C sqlcmd -S myServer\instanceName -i C:\myScript.sql
Show: Normal
Timing: After Installation
Also is there a way to install an .exe and then add a scheduled task refering to the installed .exe
This option is not supported.

Re: Schedule Task

Posted: Thu Sep 09, 2010 2:18 pm
by Always Learning
Hi There,

I have tried your suggestion and it does work if I specifically name where the script is located. I.E C:\Temp\Angtest.sql
What I want to do is use the installer to write all the files to the installDir and then reference the SqlScript in that directory.
I have tried "/C sqlcmd -S MatrixPC6\MatrixPC6_2000 -d TestInstaller -i <InstallDir>Angtest.Sql" but it does not work.
If I use "/C sqlcmd -S MatrixPC6\MatrixPC6_2000 -d TestInstaller -i C:\Temp\Angtest.Sql", where I give the location of the input file, it works.

How would I get over this.

Thanks for the help.

Best Regards,

Re: Schedule Task

Posted: Sat Sep 11, 2010 3:52 am
by Leo
In the first cmmand line you've lost the slash (\):
<InstallDir>Angtest.Sql
change to
<InstallDir>\Angtest.Sql