Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2002
    Posts
    3

    Unanswered: Providing isql input from console.

    Hi,
    I am using the following syntax to run a sql command using isql from console. Lets
    assume database is 'ddd' and table is 'ttt' and I want to do a simple 'select * from ttt'.
    The commands below works on UNIX but when running as a windows .bat file I get the
    following error message "<< was not expected on this line". I am using Windows XP professional 2002.
    The commands are

    isql -Uusername -Ppassword -Sservername <<EOF
    select * from ddd..ttt
    go
    quit
    EOF

    If i try redirecting sql from an input file using -i option it works fine on Windows as well
    as UNIX. But I want the sql to be read from the console using the <<EOF syntax. But it
    does not work on DOS. Why? Can you help me with this?

    thanks
    waavman

  2. #2
    Join Date
    Jun 2002
    Location
    Dublin, Ireland
    Posts
    23
    Hi,

    I found the same problem on Windows 2000. So I installed cygwin, which is basically an open source bash shell that you can use with Windows and that is how I got around using:

    isql -U<username> -P... << EOF

    Basically you install cygwin in your machine create your *.sql script as usual and call in a .bat file as follows:

    set path=%path%;c:\cygwin\bin
    cd \your directory\
    bash your_file_name.sql
    pause

    You can download cygwin from http://www.cygwin.com/

    Hope this will solve your problem,

    Regards,
    Mark Sheehan,
    Senior Sybase DBA

  3. #3
    Join Date
    Jul 2002
    Posts
    3
    Hi Mark,
    Thanks for the info about the UNIX emulator. I have not downloaded 'cygwin' yet because of the proxy server at my office, but I will download it and run my script as you have said. If it has worked for you, I think it should work for me too.

    thanks
    waavman

Posting Permissions

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