April 22, 2012 at 5:44 am
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
April 22, 2012 at 6:23 am
maryamzolfaghar (4/22/2012)
I need to have the messages shown in "Messages" tab when running a query in a fileCan 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
April 22, 2012 at 9:43 pm
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
April 22, 2012 at 10:43 pm
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??
April 22, 2012 at 10:50 pm
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
April 22, 2012 at 11:26 pm
April 23, 2012 at 2:48 am
Yes, exactly
Any solution?
April 23, 2012 at 4:36 am
April 23, 2012 at 4:59 am
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.
April 23, 2012 at 6:14 am
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
April 23, 2012 at 6:35 am
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
April 23, 2012 at 6:38 am
maryamzolfaghar (4/23/2012)
sqlcmd -S servername\instanceName -i inputfile -o outputfileinputfile 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
April 23, 2012 at 10:34 pm
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