Results 1 to 2 of 2

Thread: batch file

  1. #1
    Join Date
    Oct 2002
    Posts
    29

    Unanswered: batch file

    I have sql file T.sql as

    set nocount 0
    select col1,col2,col3 from T
    go

    If I run query using isql as follows

    isql -Uusr -Ppwd -iT.sql -s',' -S server

    it gives output as

    col1,col2,col3,
    -----,----,-----,
    XXX,1,100,
    YYY,2,200,
    ZZZ,3,300,

    My question is,

    Why each row end with "," even though there is no more than 3 cols?
    and how can I get in the following format?

    col1,col2,col3
    -----,----,-----
    XXX,1,100
    YYY,2,200
    ZZZ,3,300

    Thanks

  2. #2
    Join Date
    Oct 2003
    Posts
    18

    Re: batch file

    Strip the last comma?

    isql -Uusr -Ppwd -iT.sql -s',' -S server | sed 's/,$//'

Posting Permissions

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