Showing posts with label analyzer. Show all posts
Showing posts with label analyzer. Show all posts

Monday, March 26, 2012

Forcing display of QA's buffer

How can I force the contents of Query Analyzer's buffer to display to the
screen?
A stored proc has some debug PRINT statements in it. The proc takes a long
time to execute and the PRINT statements don't display until execution is
complete.
Is it possible to force them to display immediately? If so, how?How about RAISERROR WITH NOWAIT? Watch the messages pane:
PRINT 'foo'
WAITFOR DELAY '00:00:05'
GO
RAISERROR('foo', 11, 1) WITH NOWAIT
WAITFOR DELAY '00:00:05'
GO
http://www.aspfaq.com/
(Reverse address to reply.)
"Dave" <dave@.nospam.ru> wrote in message
news:uyWPdkbHFHA.2784@.TK2MSFTNGP09.phx.gbl...
> How can I force the contents of Query Analyzer's buffer to display to the
> screen?
> A stored proc has some debug PRINT statements in it. The proc takes a
long
> time to execute and the PRINT statements don't display until execution is
> complete.
> Is it possible to force them to display immediately? If so, how?
>|||Thanks Aaron
That works and it also prints out any unprinted PRINT statements previous to
the RAISERROR.
THe red error messages are a distraction but I can live with that.
Thank you.
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:uVVzjnbHFHA.4048@.TK2MSFTNGP15.phx.gbl...
> How about RAISERROR WITH NOWAIT? Watch the messages pane:
>
> PRINT 'foo'
> WAITFOR DELAY '00:00:05'
> GO
> RAISERROR('foo', 11, 1) WITH NOWAIT
> WAITFOR DELAY '00:00:05'
> GO
>
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "Dave" <dave@.nospam.ru> wrote in message
> news:uyWPdkbHFHA.2784@.TK2MSFTNGP09.phx.gbl...
> > How can I force the contents of Query Analyzer's buffer to display to
the
> > screen?
> >
> > A stored proc has some debug PRINT statements in it. The proc takes a
> long
> > time to execute and the PRINT statements don't display until execution
is
> > complete.
> >
> > Is it possible to force them to display immediately? If so, how?
> >
> >
>|||Even better, use a severity of 10 or lower to emulate what PRINT does (i.e.,
no error condition raised)...
--
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:uVVzjnbHFHA.4048@.TK2MSFTNGP15.phx.gbl...
> How about RAISERROR WITH NOWAIT? Watch the messages pane:
>
> PRINT 'foo'
> WAITFOR DELAY '00:00:05'
> GO
> RAISERROR('foo', 11, 1) WITH NOWAIT
> WAITFOR DELAY '00:00:05'
> GO
>
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "Dave" <dave@.nospam.ru> wrote in message
> news:uyWPdkbHFHA.2784@.TK2MSFTNGP09.phx.gbl...
> > How can I force the contents of Query Analyzer's buffer to display to
the
> > screen?
> >
> > A stored proc has some debug PRINT statements in it. The proc takes a
> long
> > time to execute and the PRINT statements don't display until execution
is
> > complete.
> >
> > Is it possible to force them to display immediately? If so, how?
> >
> >
>|||Good point, just in the habit of using 11.
--
http://www.aspfaq.com/
(Reverse address to reply.)
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:egrs6xbHFHA.720@.TK2MSFTNGP10.phx.gbl...
> Even better, use a severity of 10 or lower to emulate what PRINT does
(i.e.,
> no error condition raised)...
> --
> Adam Machanic
> SQL Server MVP
> http://www.sqljunkies.com/weblog/amachanic
> --
>
> "Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
> news:uVVzjnbHFHA.4048@.TK2MSFTNGP15.phx.gbl...
> > How about RAISERROR WITH NOWAIT? Watch the messages pane:
> >
> >
> > PRINT 'foo'
> > WAITFOR DELAY '00:00:05'
> > GO
> > RAISERROR('foo', 11, 1) WITH NOWAIT
> > WAITFOR DELAY '00:00:05'
> > GO
> >
> >
> > --
> > http://www.aspfaq.com/
> > (Reverse address to reply.)
> >
> >
> >
> >
> > "Dave" <dave@.nospam.ru> wrote in message
> > news:uyWPdkbHFHA.2784@.TK2MSFTNGP09.phx.gbl...
> > > How can I force the contents of Query Analyzer's buffer to display to
> the
> > > screen?
> > >
> > > A stored proc has some debug PRINT statements in it. The proc takes a
> > long
> > > time to execute and the PRINT statements don't display until execution
> is
> > > complete.
> > >
> > > Is it possible to force them to display immediately? If so, how?
> > >
> > >
> >
> >
>|||> THe red error messages are a distraction but I can live with that.
Just follow Adam's advice and lower the severity level.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"Dave" <dave@.nospam.ru> wrote in message news:emHu5xbHFHA.3780@.TK2MSFTNGP10.phx.gbl...
> Thanks Aaron
> That works and it also prints out any unprinted PRINT statements previous to
> the RAISERROR.
> THe red error messages are a distraction but I can live with that.
> Thank you.
>
> "Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
> news:uVVzjnbHFHA.4048@.TK2MSFTNGP15.phx.gbl...
>> How about RAISERROR WITH NOWAIT? Watch the messages pane:
>>
>> PRINT 'foo'
>> WAITFOR DELAY '00:00:05'
>> GO
>> RAISERROR('foo', 11, 1) WITH NOWAIT
>> WAITFOR DELAY '00:00:05'
>> GO
>>
>> --
>> http://www.aspfaq.com/
>> (Reverse address to reply.)
>>
>>
>> "Dave" <dave@.nospam.ru> wrote in message
>> news:uyWPdkbHFHA.2784@.TK2MSFTNGP09.phx.gbl...
>> > How can I force the contents of Query Analyzer's buffer to display to
> the
>> > screen?
>> >
>> > A stored proc has some debug PRINT statements in it. The proc takes a
>> long
>> > time to execute and the PRINT statements don't display until execution
> is
>> > complete.
>> >
>> > Is it possible to force them to display immediately? If so, how?
>> >
>> >
>>
>|||Got it.
Thanks
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:uj4f94bHFHA.3624@.tk2msftngp13.phx.gbl...
> > THe red error messages are a distraction but I can live with that.
> Just follow Adam's advice and lower the severity level.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> http://www.sqlug.se/
>
> "Dave" <dave@.nospam.ru> wrote in message
news:emHu5xbHFHA.3780@.TK2MSFTNGP10.phx.gbl...
> > Thanks Aaron
> >
> > That works and it also prints out any unprinted PRINT statements
previous to
> > the RAISERROR.
> >
> > THe red error messages are a distraction but I can live with that.
> >
> > Thank you.
> >
> >
> > "Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
> > news:uVVzjnbHFHA.4048@.TK2MSFTNGP15.phx.gbl...
> >> How about RAISERROR WITH NOWAIT? Watch the messages pane:
> >>
> >>
> >> PRINT 'foo'
> >> WAITFOR DELAY '00:00:05'
> >> GO
> >> RAISERROR('foo', 11, 1) WITH NOWAIT
> >> WAITFOR DELAY '00:00:05'
> >> GO
> >>
> >>
> >> --
> >> http://www.aspfaq.com/
> >> (Reverse address to reply.)
> >>
> >>
> >>
> >>
> >> "Dave" <dave@.nospam.ru> wrote in message
> >> news:uyWPdkbHFHA.2784@.TK2MSFTNGP09.phx.gbl...
> >> > How can I force the contents of Query Analyzer's buffer to display to
> > the
> >> > screen?
> >> >
> >> > A stored proc has some debug PRINT statements in it. The proc takes
a
> >> long
> >> > time to execute and the PRINT statements don't display until
execution
> > is
> >> > complete.
> >> >
> >> > Is it possible to force them to display immediately? If so, how?
> >> >
> >> >
> >>
> >>
> >
> >
>|||did you try using "results in text" instead of "results in grid"?
Dave wrote:
> How can I force the contents of Query Analyzer's buffer to display to the
> screen?
> A stored proc has some debug PRINT statements in it. The proc takes a long
> time to execute and the PRINT statements don't display until execution is
> complete.
> Is it possible to force them to display immediately? If so, how?|||SQL Server doesn't send its output to the client immediately as it is generated by the engine. This
is to consume less network resources. And this is the reason why we don't see things like PRINT
immediately after they have been performed. SQL Server will wait until its output buffer is full, or
until the batch has ended. The trick with RAISERROR and NOWAIT is that it forces SQL Server to flush
the output buffer.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"ch" <ch@.dontemailme.com> wrote in message news:42237E8F.7DC18B52@.dontemailme.com...
> did you try using "results in text" instead of "results in grid"?
>
> Dave wrote:
>> How can I force the contents of Query Analyzer's buffer to display to the
>> screen?
>> A stored proc has some debug PRINT statements in it. The proc takes a long
>> time to execute and the PRINT statements don't display until execution is
>> complete.
>> Is it possible to force them to display immediately? If so, how?|||> The trick with RAISERROR and NOWAIT is that it forces SQL Server to flush
> the output buffer.
Right, this is why you usually see the PRINT and the RAISERROR come to the
messages pane at roughly the same time, even if the PRINT is issued before a
delay and the RAISERROR comes after.
--
http://www.aspfaq.com/
(Reverse address to reply.)

Friday, March 23, 2012

Forcing display of QA's buffer

How can I force the contents of Query Analyzer's buffer to display to the
screen?
A stored proc has some debug PRINT statements in it. The proc takes a long
time to execute and the PRINT statements don't display until execution is
complete.
Is it possible to force them to display immediately? If so, how?How about RAISERROR WITH NOWAIT? Watch the messages pane:
PRINT 'foo'
WAITFOR DELAY '00:00:05'
GO
RAISERROR('foo', 11, 1) WITH NOWAIT
WAITFOR DELAY '00:00:05'
GO
http://www.aspfaq.com/
(Reverse address to reply.)
"Dave" <dave@.nospam.ru> wrote in message
news:uyWPdkbHFHA.2784@.TK2MSFTNGP09.phx.gbl...
> How can I force the contents of Query Analyzer's buffer to display to the
> screen?
> A stored proc has some debug PRINT statements in it. The proc takes a
long
> time to execute and the PRINT statements don't display until execution is
> complete.
> Is it possible to force them to display immediately? If so, how?
>|||Even better, use a severity of 10 or lower to emulate what PRINT does (i.e.,
no error condition raised)...
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:uVVzjnbHFHA.4048@.TK2MSFTNGP15.phx.gbl...
> How about RAISERROR WITH NOWAIT? Watch the messages pane:
>
> PRINT 'foo'
> WAITFOR DELAY '00:00:05'
> GO
> RAISERROR('foo', 11, 1) WITH NOWAIT
> WAITFOR DELAY '00:00:05'
> GO
>
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "Dave" <dave@.nospam.ru> wrote in message
> news:uyWPdkbHFHA.2784@.TK2MSFTNGP09.phx.gbl...
the[vbcol=seagreen]
> long
is[vbcol=seagreen]
>|||Thanks Aaron
That works and it also prints out any unprinted PRINT statements previous to
the RAISERROR.
THe red error messages are a distraction but I can live with that.
Thank you.
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:uVVzjnbHFHA.4048@.TK2MSFTNGP15.phx.gbl...
> How about RAISERROR WITH NOWAIT? Watch the messages pane:
>
> PRINT 'foo'
> WAITFOR DELAY '00:00:05'
> GO
> RAISERROR('foo', 11, 1) WITH NOWAIT
> WAITFOR DELAY '00:00:05'
> GO
>
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "Dave" <dave@.nospam.ru> wrote in message
> news:uyWPdkbHFHA.2784@.TK2MSFTNGP09.phx.gbl...
the[vbcol=seagreen]
> long
is[vbcol=seagreen]
>|||Good point, just in the habit of using 11.
http://www.aspfaq.com/
(Reverse address to reply.)
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:egrs6xbHFHA.720@.TK2MSFTNGP10.phx.gbl...
> Even better, use a severity of 10 or lower to emulate what PRINT does
(i.e.,
> no error condition raised)...
> --
> Adam Machanic
> SQL Server MVP
> http://www.sqljunkies.com/weblog/amachanic
> --
>
> "Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
> news:uVVzjnbHFHA.4048@.TK2MSFTNGP15.phx.gbl...
> the
> is
>|||> THe red error messages are a distraction but I can live with that.
Just follow Adam's advice and lower the severity level.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"Dave" <dave@.nospam.ru> wrote in message news:emHu5xbHFHA.3780@.TK2MSFTNGP10.phx.gbl...[vbcol
=seagreen]
> Thanks Aaron
> That works and it also prints out any unprinted PRINT statements previous
to
> the RAISERROR.
> THe red error messages are a distraction but I can live with that.
> Thank you.
>
> "Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
> news:uVVzjnbHFHA.4048@.TK2MSFTNGP15.phx.gbl...
> the
> is
>[/vbcol]|||Got it.
Thanks
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:uj4f94bHFHA.3624@.tk2msftngp13.phx.gbl...
> Just follow Adam's advice and lower the severity level.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> http://www.sqlug.se/
>
> "Dave" <dave@.nospam.ru> wrote in message
news:emHu5xbHFHA.3780@.TK2MSFTNGP10.phx.gbl...
previous to[vbcol=seagreen]
a[vbcol=seagreen]
execution[vbcol=seagreen]
>|||did you try using "results in text" instead of "results in grid"?
Dave wrote:
> How can I force the contents of Query Analyzer's buffer to display to the
> screen?
> A stored proc has some debug PRINT statements in it. The proc takes a lon
g
> time to execute and the PRINT statements don't display until execution is
> complete.
> Is it possible to force them to display immediately? If so, how?|||SQL Server doesn't send its output to the client immediately as it is genera
ted by the engine. This
is to consume less network resources. And this is the reason why we don't se
e things like PRINT
immediately after they have been performed. SQL Server will wait until its o
utput buffer is full, or
until the batch has ended. The trick with RAISERROR and NOWAIT is that it fo
rces SQL Server to flush
the output buffer.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"ch" <ch@.dontemailme.com> wrote in message news:42237E8F.7DC18B52@.dontemailme.com...[vbcol=s
eagreen]
> did you try using "results in text" instead of "results in grid"?
>
> Dave wrote:|||> The trick with RAISERROR and NOWAIT is that it forces SQL Server to flush
> the output buffer.
Right, this is why you usually see the PRINT and the RAISERROR come to the
messages pane at roughly the same time, even if the PRINT is issued before a
delay and the RAISERROR comes after.
http://www.aspfaq.com/
(Reverse address to reply.)sql

Wednesday, March 7, 2012

FOR XML clause and <root> element


Hi,
When I run the following query in Query Analyzer, it works fine, but I
cannot add <ROOT> ... </ROOT> element to result:
SELECT * FROM
(
select top 10
CompanyName,
SUM((CONVERT(money,("Order
Details".UnitPrice*Quantity*(1-Discount)/100))*100)) AS Amount
, count(*) OrderItemCount
from
customers
inner join orders on orders.CustomerID = customers.CustomerID
inner join [Order Details] on Orders.OrderID = [Order Details].OrderID
GROUP BY
CompanyName
) AS GoodCustomers
FOR XML AUTO ,ELEMENTS
Ho can add <root> element to the result?
Thank you,
AlanHi
You can do that externally such as http://sqlxml.org/faqs.aspx?faq=10
This may also help http://www.perfectxml.com/Articles/XML/ExportSQLXML.asp
John
"A.M" wrote:

>
> Hi,
>
> When I run the following query in Query Analyzer, it works fine, but I
> cannot add <ROOT> ... </ROOT> element to result:
>
>
> SELECT * FROM
> (
> select top 10
> CompanyName,
> SUM((CONVERT(money,("Order
> Details".UnitPrice*Quantity*(1-Discount)/100))*100)) AS Amount
> , count(*) OrderItemCount
> from
> customers
> inner join orders on orders.CustomerID = customers.CustomerID
> inner join [Order Details] on Orders.OrderID = [Order Details].OrderID
> GROUP BY
> CompanyName
> ) AS GoodCustomers
> FOR XML AUTO ,ELEMENTS
>
>
>
>
>
> Ho can add <root> element to the result?
>
> Thank you,
> Alan
>
>|||Hi,
Additional to what John recommanded, there is a new property that you can
use to tell the OLEDB provider to add
the root tag for you.
command.Properties("Output Stream") = response
command.Properties("XML Root") = "root"
command.Execute , , 1024
Then the stream you are getting back will have "XML Root" as the document
root tag.
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.

FOR XML AUTO, ELEMENTS

I am using SQL Server 2000.
When I run SQL in Query Analyzer similar to the following, each row in the
results is truncated to 256 characters:
SELECT * FROM tblName
FOR XML AUTO, ELEMENTS
How can I prevent the output from truncating each row?
Also, is it possible for the output to be formatted with a CRLF after each
element, and appropriate indentation of elements?
Thanks
Bill
First, you can increase the limit of the result to 4000 characters. That way
you will see everything. However, since the query analyzer does not really
understand the XML, you should not attempt to use the XML there except for
doing visual checks. If you want to get the XML in a stream, use either the
ADO/ADO.Net mechanisms to get the XML stream back or use the SQLXML ISAPI.
In the later case, you would access the data through IE, and thus you would
get your pretty-printing of the XML.
Best regards
Michael
"bill" <belgie@.datamti.com> wrote in message
news:eHYVIBm3FHA.3952@.TK2MSFTNGP10.phx.gbl...
>I am using SQL Server 2000.
> When I run SQL in Query Analyzer similar to the following, each row in the
> results is truncated to 256 characters:
> SELECT * FROM tblName
> FOR XML AUTO, ELEMENTS
> How can I prevent the output from truncating each row?
> Also, is it possible for the output to be formatted with a CRLF after each
> element, and appropriate indentation of elements?
> Thanks
> Bill
>
|||I always change my settings to display 8192 instead of the annoying 256
standard. 8192 seems to be the maximum, but perhaps I have 4192 too much?
Best regards
Niklas Engfelt
"Michael Rys [MSFT]" <mrys@.online.microsoft.com> wrote in message
news:%23lVFYRm3FHA.3400@.tk2msftngp13.phx.gbl...
> First, you can increase the limit of the result to 4000 characters. That
> way you will see everything. However, since the query analyzer does not
> really understand the XML, you should not attempt to use the XML there
> except for doing visual checks. If you want to get the XML in a stream,
> use either the ADO/ADO.Net mechanisms to get the XML stream back or use
> the SQLXML ISAPI. In the later case, you would access the data through IE,
> and thus you would get your pretty-printing of the XML.
> Best regards
> Michael
> "bill" <belgie@.datamti.com> wrote in message
> news:eHYVIBm3FHA.3952@.TK2MSFTNGP10.phx.gbl...
>
|||Too much is not a problem. The reason why I said 4000 is that each stream
block (ie a row chunk) that is being returned is around 2034 bytes, so 4000
is enough).
But regardless of the setting, if you get the XML in more than one chunk in
the query analyzer, you will have to do some postprocessing to get rid of
the newlines.
Best regards
Mcihael
"Niklas E" <raven_tln0sp4m@.hotmail.com> wrote in message
news:%23MC0RKy4FHA.2364@.TK2MSFTNGP12.phx.gbl...
>I always change my settings to display 8192 instead of the annoying 256
>standard. 8192 seems to be the maximum, but perhaps I have 4192 too much?
> Best regards
> Niklas Engfelt
>
> "Michael Rys [MSFT]" <mrys@.online.microsoft.com> wrote in message
> news:%23lVFYRm3FHA.3400@.tk2msftngp13.phx.gbl...
>
|||Yes a bit annoying that you have to do that yourself instead of checking
that "Don't give me irrelevant New-Lines"-CheckBox in QA. It would have
been nicer without this setting and that QA automatically gave you the
correct line length and that stream blocks were automatically appended as
well. I don't know any people who want them divided this way. Divided
between the tags works fine, but not like this in the middle after 2034
bytes.
I have found EmEditor to be very useful in these cases with its RegExp Find
& Replace: \r\n -> <nothing>.
Best regards
Niklas Engfelt
"Michael Rys [MSFT]" <mrys@.online.microsoft.com> wrote in message
news:uRu47C16FHA.3232@.TK2MSFTNGP15.phx.gbl...
> Too much is not a problem. The reason why I said 4000 is that each stream
> block (ie a row chunk) that is being returned is around 2034 bytes, so
> 4000 is enough).
> But regardless of the setting, if you get the XML in more than one chunk
> in the query analyzer, you will have to do some postprocessing to get rid
> of the newlines.
> Best regards
> Mcihael
> "Niklas E" <raven_tln0sp4m@.hotmail.com> wrote in message
> news:%23MC0RKy4FHA.2364@.TK2MSFTNGP12.phx.gbl...
>
|||Well, yes. The SQL Server 2005 integration is now much better, we even have
a hyperlink triggered XML editor build in now.
So go out and upgrade :-).
Best regards
Michael
"Niklas E" <raven_tln0sp4m@.hotmail.com> wrote in message
news:%23927VrQAGHA.832@.tk2msftngp13.phx.gbl...
> Yes a bit annoying that you have to do that yourself instead of checking
> that "Don't give me irrelevant New-Lines"-CheckBox in QA. It would have
> been nicer without this setting and that QA automatically gave you the
> correct line length and that stream blocks were automatically appended as
> well. I don't know any people who want them divided this way. Divided
> between the tags works fine, but not like this in the middle after 2034
> bytes.
> I have found EmEditor to be very useful in these cases with its RegExp
> Find & Replace: \r\n -> <nothing>.
> Best regards
> Niklas Engfelt
>
> "Michael Rys [MSFT]" <mrys@.online.microsoft.com> wrote in message
> news:uRu47C16FHA.3232@.TK2MSFTNGP15.phx.gbl...
>

FOR XML AUTO, ELEMENTS

I am using SQL Server 2000.
When I run SQL in Query Analyzer similar to the following, each row in the
results is truncated to 256 characters:
SELECT * FROM tblName
FOR XML AUTO, ELEMENTS
How can I prevent the output from truncating each row?
Also, is it possible for the output to be formatted with a CRLF after each
element, and appropriate indentation of elements?
Thanks
BillFirst, you can increase the limit of the result to 4000 characters. That way
you will see everything. However, since the query analyzer does not really
understand the XML, you should not attempt to use the XML there except for
doing visual checks. If you want to get the XML in a stream, use either the
ADO/ADO.Net mechanisms to get the XML stream back or use the SQLXML ISAPI.
In the later case, you would access the data through IE, and thus you would
get your pretty-printing of the XML.
Best regards
Michael
"bill" <belgie@.datamti.com> wrote in message
news:eHYVIBm3FHA.3952@.TK2MSFTNGP10.phx.gbl...
>I am using SQL Server 2000.
> When I run SQL in Query Analyzer similar to the following, each row in the
> results is truncated to 256 characters:
> SELECT * FROM tblName
> FOR XML AUTO, ELEMENTS
> How can I prevent the output from truncating each row?
> Also, is it possible for the output to be formatted with a CRLF after each
> element, and appropriate indentation of elements?
> Thanks
> Bill
>|||I always change my settings to display 8192 instead of the annoying 256
standard. 8192 seems to be the maximum, but perhaps I have 4192 too much?
Best regards
Niklas Engfelt
"Michael Rys [MSFT]" <mrys@.online.microsoft.com> wrote in message
news:%23lVFYRm3FHA.3400@.tk2msftngp13.phx.gbl...
> First, you can increase the limit of the result to 4000 characters. That
> way you will see everything. However, since the query analyzer does not
> really understand the XML, you should not attempt to use the XML there
> except for doing visual checks. If you want to get the XML in a stream,
> use either the ADO/ADO.Net mechanisms to get the XML stream back or use
> the SQLXML ISAPI. In the later case, you would access the data through IE,
> and thus you would get your pretty-printing of the XML.
> Best regards
> Michael
> "bill" <belgie@.datamti.com> wrote in message
> news:eHYVIBm3FHA.3952@.TK2MSFTNGP10.phx.gbl...
>|||Too much is not a problem. The reason why I said 4000 is that each stream
block (ie a row chunk) that is being returned is around 2034 bytes, so 4000
is enough).
But regardless of the setting, if you get the XML in more than one chunk in
the query analyzer, you will have to do some postprocessing to get rid of
the newlines.
Best regards
Mcihael
"Niklas E" <raven_tln0sp4m@.hotmail.com> wrote in message
news:%23MC0RKy4FHA.2364@.TK2MSFTNGP12.phx.gbl...
>I always change my settings to display 8192 instead of the annoying 256
>standard. 8192 seems to be the maximum, but perhaps I have 4192 too much?
> Best regards
> Niklas Engfelt
>
> "Michael Rys [MSFT]" <mrys@.online.microsoft.com> wrote in message
> news:%23lVFYRm3FHA.3400@.tk2msftngp13.phx.gbl...
>|||Yes a bit annoying that you have to do that yourself instead of checking
that "Don't give me irrelevant New-Lines"-CheckBox in QA. :) It would have
been nicer without this setting and that QA automatically gave you the
correct line length and that stream blocks were automatically appended as
well. I don't know any people who want them divided this way. Divided
between the tags works fine, but not like this in the middle after 2034
bytes.
I have found EmEditor to be very useful in these cases with its RegExp Find
& Replace: \r\n -> <nothing>.
Best regards
Niklas Engfelt
"Michael Rys [MSFT]" <mrys@.online.microsoft.com> wrote in message
news:uRu47C16FHA.3232@.TK2MSFTNGP15.phx.gbl...
> Too much is not a problem. The reason why I said 4000 is that each stream
> block (ie a row chunk) that is being returned is around 2034 bytes, so
> 4000 is enough).
> But regardless of the setting, if you get the XML in more than one chunk
> in the query analyzer, you will have to do some postprocessing to get rid
> of the newlines.
> Best regards
> Mcihael
> "Niklas E" <raven_tln0sp4m@.hotmail.com> wrote in message
> news:%23MC0RKy4FHA.2364@.TK2MSFTNGP12.phx.gbl...
>|||Well, yes. The SQL Server 2005 integration is now much better, we even have
a hyperlink triggered XML editor build in now.
So go out and upgrade :-).
Best regards
Michael
"Niklas E" <raven_tln0sp4m@.hotmail.com> wrote in message
news:%23927VrQAGHA.832@.tk2msftngp13.phx.gbl...
> Yes a bit annoying that you have to do that yourself instead of checking
> that "Don't give me irrelevant New-Lines"-CheckBox in QA. :) It would have
> been nicer without this setting and that QA automatically gave you the
> correct line length and that stream blocks were automatically appended as
> well. I don't know any people who want them divided this way. Divided
> between the tags works fine, but not like this in the middle after 2034
> bytes.
> I have found EmEditor to be very useful in these cases with its RegExp
> Find & Replace: \r\n -> <nothing>.
> Best regards
> Niklas Engfelt
>
> "Michael Rys [MSFT]" <mrys@.online.microsoft.com> wrote in message
> news:uRu47C16FHA.3232@.TK2MSFTNGP15.phx.gbl...
>