Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
bevans
Starting Member
10 Posts |
Posted - 2012-04-12 : 10:30:03
|
| Hi,I currently have the following setup:I'm executing the following SQL command: Which executes a scheduled task on an app serverexec master.dbo.xp_cmdshell 'schtasks /run /s Appserver-test /U gray\svc_serviceaccount /P 123456 /tn "\EXPORT TEST"'This scheduled task runs this file:C:\Export parameters\exporttest.batI was wondering, is it possible to execute this bat file directly, via a sql script. So instead of executing the scheduled task, which executes the bat file, I simply execute the bat file directly instead |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
vinu.vijayan
Posting Yak Master
227 Posts |
Posted - 2012-04-13 : 01:51:52
|
| I have a batch file which takes database and server names as input from the user using cmdprompt(sqlcmd) and produces a backup of the db.I tried running the file using Sql Server(using xp_cmd shell). But, instead of running the batch file, the statement produced a table with a single column(named OUTPUT) and these were the contents of the column:NULLC:\WINDOWS\system32>echo off Enter database name: Enter_Your_SQL_ServerName_here: Sqlcmd: '-S': Missing argument. Enter '-?' for help.NULLNULLThis is actually the code and maybe the compiled view of the code.So I googled this for a while and read somewhere that I could run the batch file as follows:1. Create a package in SSIS containing the batch file in the form of an "Execute Process Task". This link throws some light on that:[url]http://msdn.microsoft.com/en-us/library/ms141166.aspx[/url]2. Save the package and then call the package as part of a job step.3. Run the Job.This worked for me. Hope it works for you as well.Vinu VijayanN 28° 33' 11.93148"E 77° 14' 33.66384" |
 |
|
|
|
|
|