PHISSUG

Home of Filipino Sql Server Enthusiasts
Welcome to PHISSUG Sign in | Join | Help
in Search

Logging to textfile all activities using iSQL output file

Last post 09-15-2007, 12:29 AM by ggsubscribe. 8 replies.
Sort Posts: Previous Next
  •  09-11-2007, 2:00 AM 2030

    Logging to textfile all activities using iSQL output file

    I am using iSQL from MS SQL Server 2000 tools to run a query thru command line. Have tried using the -o <outputfile> option but it only save the last command, it didnt append to a single log file. Is it possible to save activities thru a single logfile?
  •  09-11-2007, 3:00 AM 2031 in reply to 2030

    Re: Logging to textfile all activities using iSQL output file

    Hi mpMS,

    instead of        -o outputfile.txt

    use                  >> outputfile.txt       instead

    ~hope this will help

  •  09-11-2007, 4:49 PM 2033 in reply to 2031

    Re: Logging to textfile all activities using iSQL output file

    Thanks for this. Just noticed that the log doesnt contain date and time. Is it possible to include it on the log file?
  •  09-11-2007, 8:22 PM 2037 in reply to 2033

    Re: Logging to textfile all activities using iSQL output file

    please put

    PRINT GetDate()   

    in the script that you will going to run.

    ~hope this will help

  •  09-13-2007, 12:14 AM 2038 in reply to 2037

    Re: Logging to textfile all activities using iSQL output file

    Arthur Jr:

    please put

    PRINT GetDate()   

    in the script that you will going to run.

    ~hope this will help



    I am using this command:
    isql -d myDB -U sa -P password -Q "BACKUP DATABASE myDB TO DISK='G:\Backup\myDB.BAK'" >> C:\myDB_log.log

    It only have one SQL statement. How can I include the line that you gave on my script?
  •  09-13-2007, 1:44 AM 2039 in reply to 2038

    Re: Logging to textfile all activities using iSQL output file

    isql -d myDB -U sa -P password -Q "BACKUP DATABASE myDB TO DISK='G:\Backup\myDB.BAK' ; PRINT GetDate()" >> C:\myDB_log.log

     

    ~hth

  •  09-13-2007, 3:12 AM 2042 in reply to 2039

    Re: Logging to textfile all activities using iSQL output file

    or,

    during my DOS days, I'd probably save the following in MYSCRIPTS.BAT

    isql -d myDB -U sa -P password -Q "BACKUP DATABASE myDB TO DISK='G:\Backup\myDB.BAK' >> C:\myDB_log.log
    date /t >> C:\myDB_log.log
    time /t >> C:\myDB_log.log

    Stick out tongue [:P]

    or if you have multiple lengthy scripts, you can execute each query file (*.SQL) in batches. Check BOL for samples.

     

  •  09-14-2007, 10:57 PM 2046 in reply to 2042

    Re: Logging to textfile all activities using iSQL output file

    Have another question, what if I want to include the following on the log using the iSQL CLI:

    sample logfile:

    Backup Start Date: 09-15-2007 14:00
    Database: myDB
    Backup End Date: 09-15-2007 14:30
    Database size: 100MB

    Is this possible?
  •  09-15-2007, 12:29 AM 2047 in reply to 2046

    Re: Logging to textfile all activities using iSQL output file

    basically, you can have anything in the log. Anything that is displayed by iSQL can be captured. You can use PRINT inside the scripts to output anything to the log file.
View as RSS news feed in XML
Powered by Community Server (Personal Edition), by Telligent Systems