Messages Tab (Query)

  • I need to have the messages shown in "Messages" tab when running a query in a file

    Can anyone help?

    The quesry is sth like this:

    SET STATISTICS TIME ON

    select *

    from [a view]

    SET STATISTICS TIME OFF

  • maryamzolfaghar (4/22/2012)


    I need to have the messages shown in "Messages" tab when running a query in a file

    Can anyone help?

    The quesry is sth like this:

    SET STATISTICS TIME ON

    select *

    from [a view]

    SET STATISTICS TIME OFF

    Which messages are you talking about? Do you want number of rows, code run etc on the messages?

    Need more to answer this.

    Fitz

  • I need the messages like this:

    SQL Server Execution Times:

    CPU time = 0 ms, elapsed time = 0 ms.

    We have 2 tabs when running a query

    One is "Results" and the other is "Messages"

    I want what is written in "Messages" tab.

    I ofcourse see the messages, but I want them to be written in a file

  • If you use the following code:

    SET STATISTICS TIME ON

    select *

    from [a view]

    SET STATISTICS TIME OFF

    then it shows the Time Statistics in the message tab....so what is the problem here??...aren't you seeing any messages in the Message tab??

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • I ofcourse see the messages, but I want them to be written in a file

    See my first post: I need to have the messages shown in "Messages" tab when running a query in a file

  • I am guessing, you must want to do that dynamically everytime a query is run....right??

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • Yes, exactly

    Any solution?

  • Nope...too good a problem for me...I guess...if you find a solution..do post it here...would love to know

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • It's nothing to do with T-SQL or a query as query itself cannot direct its output.

    You can do it in your application by handling ADO InfoMessage event.

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • sqlcmd -S servername\instanceName -i inputfile -o outputfile

    inputfile contains the sql query

    outputfile: The output goes here, but the results tab output and messages pad are both included

    I need the one in messages tab ONLY

  • sqlcmd -S servername\instanceName -i inputfile -o outputfile

    inputfile contains the sql query

    outputfile: The output goes here, but the results tab output and messages pad are both included

    I need the one in messages tab ONLY

  • maryamzolfaghar (4/23/2012)


    sqlcmd -S servername\instanceName -i inputfile -o outputfile

    inputfile contains the sql query

    outputfile: The output goes here, but the results tab output and messages pad are both included

    I need the one in messages tab ONLY

    You can use :Out command to redirects all query results to one file

    and :Perftrace command to redirect performance trace information to another file.

    If you want to get "messages" only, you will need to write a program which will handle ADO InfoMessage event.

    You may try to use :Out to redirect query results to STDERR or STDOUT

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • Do u have the sample program which handles ADO InfoMessage event?

    Or can u send me a sample of using :OUT (complete command) please?

Viewing 13 posts - 1 through 12 (of 12 total)

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