How to spool sql output to a file?

  • Is there anyway I can spool or write the output of sql statements to a file? I would like to spool the output of the following commands:

    --Check concurrent sessions in DB.

    select count(*) from sessions where datediff(minute, timestamp, getdate())< 10

    --How many items are locking.

    sp_lock

    --Who is causing the locking. Use the spid from the sp_lock results

    --and link to the spid from the sp_who results.

    sp_who

    We have SQL Server 2000.

    Thanks in advance, Kevin

  • you can run this from SQLCMD (command line) and that would do it.

  • Are you talking about using isql or osql?

    Thanks, Kevin

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply