Batch to Run Sybase Script

Posted on 2009-05-06
Last Modified: 2012-05-06
Hello ,

i have this batch file to generator report , as below code i do .

every time i want to set date FROM , TO , That should i edit batch.sql file to change date manually

now i need one batch to run this batch by set date from to without edit .sql file any more

Batch : 

isql -U -P -S -ic:\Batches\batch_statistics.sql -oc:\batch_statistics.err

.SQL file :

use test


exec test..batch_statistics "formdate","todate"


From and To Dates should be like this : "20090507" , YYYYMMDD

Open in new window

Question by:palserv
  • 2
  • 2
LVL 68

Accepted Solution

Qlemo earned 500 total points
ID: 24323558
To start with, see the code below. How do you want to edit the dates? Provide them when the batch is run, so you are asked for it? Or using actual date? The code shown asks for both dates.

@echo off

set /P fromdate=From Date: 

set /P todate=To Date: 

(echo use test

 echo go

 echo exec test..batch_statistics "%fromdate%","%todate%"

 echo go

) | isql -U -P -S -oc:\batch_statistics.err

Open in new window


Author Comment

ID: 24323858

i cant connect to server ,  maybe should we put isql first??
LVL 68

Expert Comment

ID: 24324857
If your isql line works, mine should, too.
LVL 19

Expert Comment

ID: 24327652
You have to put values in for -U (user id) -P (password), and -S (server).

Just use ISQL from the command line until you get the login stuff correct.


Author Comment

ID: 24347064
Thanks Alot for your helping


Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
.csv files 5 87
how to pick file up from ftp via batch file 2 48
Powershell pass array of objects to another script 8 46
Change path in batch file 2 31
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

28 Experts available now in Live!

Get 1:1 Help Now