Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2002

    Question Unanswered: exportin DATA and columns to text file ??

    Could anyone please tell me how I can export data along with the column headings to a text file using dbisql accessing a sybase database ?? Or is there a good windows based tool I can use to do this ??

    Thank you

  2. #2
    Join Date
    May 2008
    NJ, USA.
    I can use the answer to this question too !
    Using OUTPUT seem to do it but I need to use it with variable filename. UNLOAD supports using variable filename but doesn't support printing headers !! ugh!

    Any answers/help will be much appreciated.

    Thanks !

  3. #3
    Join Date
    Feb 2004
    In front of the computer
    Provided Answers: 54
    Keep in mind that I'm a geek, DBA, reformed programmer, etc. The answers that are easy and intuitive to me may or may not work for you.

    My first answer would be PowerShell because it is free with Windows, easy, and wildly powerful.

    If you need something that is portable to other platforms (like Linix, etc), then I'd probably choose Perl.

    If you want something readily available to most users and very, very familiar to them then I'd consider using Excel. A few macros can do amazing things!

    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  4. #4
    Join Date
    May 2008
    NJ, USA.

    Found the answer !

    Thanks PatP !
    Unfortunately I had to get it done using scripts itself (missed to mention it in my note below rt ? ) since I had to get the data exported from multiple dbs remotely situated in an automated way and using dbisql.
    A Simple union seemed to solve the issue... The only catch is I had to CAST any data type to Char/varchar type.
    A sample set below ..

    DECLARE @output_filepath char (100);
    DECLARE @output_filename char (100);

    SET @output_filepath='C:\Path\'_'||db_name();
    SET @output_filename = @output_filepath||'_filename.csv';
    SELECT 'ColName1','ColName2','ColName3'
    SELECT Col1,Col2,CAST(c.Col3 AS VARCHAR)
    FROM contact c
    To @output_filename ;


    Thanks Again for your suggestions...

Posting Permissions

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