Batch to Run Sybase Script

Posted on 2009-05-06
Medium Priority
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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 70

Accepted Solution

Qlemo earned 2000 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 70

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
AutoHotkey is an excellent, free, open source programming/scripting language for Windows. It started out as a keyboard/mouse macros product, but has expanded into a robust language. This article provides an introduction to it, with links to addition…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

765 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