Results 1 to 9 of 9
  1. #1
    Join Date
    Feb 2011
    Posts
    8

    Unanswered: 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.

  2. #2
    Join Date
    Apr 2008
    Location
    Iasi, Romania
    Posts
    561
    Provided Answers: 2
    isql -Ulogin_name -Plogin_password -Sserver_name -i$SYBASE/@SYBASE-ASE/scripts/script_file
    Florin Aparaschivei
    DB2 9.7, 10.5 on Windows
    Iasi, Romania

  3. #3
    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.

  4. #4
    Join Date
    May 2008
    Posts
    35
    whatever you wanted to execute on sybase put them in that script file.

  5. #5
    Join Date
    Apr 2008
    Location
    Iasi, Romania
    Posts
    561
    Provided Answers: 2
    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
    DB2 9.7, 10.5 on Windows
    Iasi, Romania

  6. #6
    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.

  7. #7
    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.

  8. #8
    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.

  9. #9
    Join Date
    Apr 2008
    Location
    Iasi, Romania
    Posts
    561
    Provided Answers: 2
    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
    DB2 9.7, 10.5 on Windows
    Iasi, Romania

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •