If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Sybase > Automatic Sybase command from batch file

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-08-11, 07:08
hary hary is offline
Registered User
 
Join Date: Feb 2011
Posts: 8
Automatic Sybase command from batch file

Hi,

I'm newbe with Sybase. I'm using ASE 12.5 and I want to create one DOS batch file in order to launch many Sybase commands automatically.

For example, execute some stored procedures then copy out tables by using bcp command.

Could someone help me please on hwo to write the batch file with isql commands?

Thanx in advance.
Reply With Quote
  #2 (permalink)  
Old 03-09-11, 02:52
aflorin27 aflorin27 is offline
Registered User
 
Join Date: Apr 2008
Location: Iasi, Romania
Posts: 317
isql -Ulogin_name -Plogin_password -Sserver_name -i$SYBASE/@SYBASE-ASE/scripts/script_file
__________________
Florin Aparaschivei
Iasi, Romania
Reply With Quote
  #3 (permalink)  
Old 03-09-11, 03:26
hary hary is offline
Registered User
 
Join Date: Feb 2011
Posts: 8
Quote:
Originally Posted by aflorin27 View Post
isql -Ulogin_name -Plogin_password -Sserver_name -i$SYBASE/@SYBASE-ASE/scripts/script_file
Thank you for the response.
But could you please share with me what will be the content of the script file?

Excuse me as it's new for me.
Reply With Quote
  #4 (permalink)  
Old 03-09-11, 06:43
dinjo_jo dinjo_jo is offline
Registered User
 
Join Date: May 2008
Posts: 34
whatever you wanted to execute on sybase put them in that script file.
Reply With Quote
  #5 (permalink)  
Old 03-10-11, 03:59
aflorin27 aflorin27 is offline
Registered User
 
Join Date: Apr 2008
Location: Iasi, Romania
Posts: 317
In my example, I've shown you how to execute one of the Sybase scripts files from the $SYBASE/@SYBASE-ASE/scripts folder. Open any file from that folder with a text editor and see what they've put there: SQL and T_SQL statements.
The idea is:
1. create such a script file, with your Sybase statements
2. create a .bat file with the isql statement like above that calls (with -i) your script file
3. run the .bat file
__________________
Florin Aparaschivei
Iasi, Romania
Reply With Quote
  #6 (permalink)  
Old 03-10-11, 05:38
hary hary is offline
Registered User
 
Join Date: Feb 2011
Posts: 8
Quote:
Originally Posted by dinjo_jo View Post
whatever you wanted to execute on sybase put them in that script file.
Hi,

I know that I have to put all commands I want to execute in the script file.
But my concern is about the content. Does it mean that I put only isql command inside it without DOS command?

Thx in advance.
Reply With Quote
  #7 (permalink)  
Old 03-10-11, 05:46
hary hary is offline
Registered User
 
Join Date: Feb 2011
Posts: 8
Quote:
Originally Posted by aflorin27 View Post
In my example, I've shown you how to execute one of the Sybase scripts files from the $SYBASE/@SYBASE-ASE/scripts folder. Open any file from that folder with a text editor and see what they've put there: SQL and T_SQL statements.
The idea is:
1. create such a script file, with your Sybase statements
2. create a .bat file with the isql statement like above that calls (with -i) your script file
3. run the .bat file
Hi,

Does it mean that I have to put script file at $SYBASE/@SYBASE-ASE/scripts and then create .bat file to execute the commad you mentionned above?

Thx.
Reply With Quote
  #8 (permalink)  
Old 03-10-11, 08:34
hary hary is offline
Registered User
 
Join Date: Feb 2011
Posts: 8
Quote:
Originally Posted by hary View Post
Hi,

Does it mean that I have to put script file at $SYBASE/@SYBASE-ASE/scripts and then create .bat file to execute the commad you mentionned above?

Thx.
Excuse me, I'm back again, what is the meaning of $SYBASE/@SYBASE-ASE and what should be the exacte value of it?

Thx in advance.
Reply With Quote
  #9 (permalink)  
Old 03-10-11, 10:36
aflorin27 aflorin27 is offline
Registered User
 
Join Date: Apr 2008
Location: Iasi, Romania
Posts: 317
Quote:
Originally Posted by hary View Post
Excuse me, I'm back again, what is the meaning of $SYBASE/@SYBASE-ASE and what should be the exacte value of it?
These are environment variables that SYBASE needs.
You don't have to create the script files in that specific path, you may put them anywhere on your server.
__________________
Florin Aparaschivei
Iasi, Romania
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On