<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; A Brief Note on SET TEXTSIZE</title>
	<atom:link href="http://blog.sqlauthority.com/2012/08/28/sql-server-a-brief-note-on-set-textsize/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2012/08/28/sql-server-a-brief-note-on-set-textsize/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Sat, 25 May 2013 01:31:40 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: SET TEXTSIZE &#8211; Good or Evil? &#171; SQL from the Trenches</title>
		<link>http://blog.sqlauthority.com/2012/08/28/sql-server-a-brief-note-on-set-textsize/#comment-338471</link>
		<dc:creator><![CDATA[SET TEXTSIZE &#8211; Good or Evil? &#171; SQL from the Trenches]]></dc:creator>
		<pubDate>Tue, 28 Aug 2012 19:59:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20468#comment-338471</guid>
		<description><![CDATA[[...] one of those articles was written by Pinal Dave (Blog &#124; Twitter). He wrote a blogpost about SET TEXTSIZE. I wasn&#8217;t familiar with that functionality, so I decided to take it out for a [...]]]></description>
		<content:encoded><![CDATA[<p>[...] one of those articles was written by Pinal Dave (Blog | Twitter). He wrote a blogpost about SET TEXTSIZE. I wasn&#8217;t familiar with that functionality, so I decided to take it out for a [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: abhIShek BandI</title>
		<link>http://blog.sqlauthority.com/2012/08/28/sql-server-a-brief-note-on-set-textsize/#comment-338356</link>
		<dc:creator><![CDATA[abhIShek BandI]]></dc:creator>
		<pubDate>Tue, 28 Aug 2012 12:28:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20468#comment-338356</guid>
		<description><![CDATA[USE TempDB
GO
-- Create TestTable
CREATE TABLE MyTable (ID INT, MyText VARCHAR(MAX),newtext nvarchar(max)) 
GO
INSERT MyTable (ID, MyText, newtext )
VALUES(1, REPLICATE(&#039;1234567890&#039;, 100), REPLICATE(&#039;1234567890&#039;, 100)) 
GO
-- Select Data
SELECT ID, MyText
FROM MyTable
GO
-- Using Left
SELECT ID, LEFT(MyText, 5) MyText,LEFT(NEWTEXT,5)newtext
FROM MyTable
GO
-- Set TextSize
SET TEXTSIZE 5;
SELECT ID, MyText,newtext 
FROM MyTable;
SET TEXTSIZE 2147483647
GO
-- Clean up
DROP TABLE MyTable
GO]]></description>
		<content:encoded><![CDATA[<p>USE TempDB<br />
GO<br />
&#8211; Create TestTable<br />
CREATE TABLE MyTable (ID INT, MyText VARCHAR(MAX),newtext nvarchar(max))<br />
GO<br />
INSERT MyTable (ID, MyText, newtext )<br />
VALUES(1, REPLICATE(&#8217;1234567890&#8242;, 100), REPLICATE(&#8217;1234567890&#8242;, 100))<br />
GO<br />
&#8211; Select Data<br />
SELECT ID, MyText<br />
FROM MyTable<br />
GO<br />
&#8211; Using Left<br />
SELECT ID, LEFT(MyText, 5) MyText,LEFT(NEWTEXT,5)newtext<br />
FROM MyTable<br />
GO<br />
&#8211; Set TextSize<br />
SET TEXTSIZE 5;<br />
SELECT ID, MyText,newtext<br />
FROM MyTable;<br />
SET TEXTSIZE 2147483647<br />
GO<br />
&#8211; Clean up<br />
DROP TABLE MyTable<br />
GO</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: abhIShek BandI</title>
		<link>http://blog.sqlauthority.com/2012/08/28/sql-server-a-brief-note-on-set-textsize/#comment-338350</link>
		<dc:creator><![CDATA[abhIShek BandI]]></dc:creator>
		<pubDate>Tue, 28 Aug 2012 12:19:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20468#comment-338350</guid>
		<description><![CDATA[Hi Pinal,

When we use TEXTSIZE in a session, this is considering only &quot;n&quot; bytes of each column with datatype is related to varchar or nvarchar.


below query show the same.
and when  i try to use execution plan, its throws exception like ... 


An error occurred while executing batch. Error message is: Error processing execution plan results. The error message is:
There is an error in XML document (1, 1).
Data at the root level is invalid. Line 1, position 1.

i guess , the xml document is picking up first five characters.
correct me if am wrong view..




USE TempDB
GO
-- Create TestTable
CREATE TABLE MyTable (ID INT, MyText VARCHAR(MAX),newtext nvarchar(max))
GO
INSERT MyTable (ID, MyText, newtext )
VALUES(1, REPLICATE(&#039;1234567890&#039;, 100), REPLICATE(&#039;1234567890&#039;, 100))
GO
-- Select Data
SELECT ID, MyText
FROM MyTable
GO
-- Using Left
SELECT ID, LEFT(MyText, 10) MyText
FROM MyTable
GO
-- Set TextSize
SET TEXTSIZE 5;
SELECT ID, MyText,newtext 
FROM MyTable;
SET TEXTSIZE 2147483647
GO
-- Clean up
DROP TABLE MyTable
GO]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>When we use TEXTSIZE in a session, this is considering only &#8220;n&#8221; bytes of each column with datatype is related to varchar or nvarchar.</p>
<p>below query show the same.<br />
and when  i try to use execution plan, its throws exception like &#8230; </p>
<p>An error occurred while executing batch. Error message is: Error processing execution plan results. The error message is:<br />
There is an error in XML document (1, 1).<br />
Data at the root level is invalid. Line 1, position 1.</p>
<p>i guess , the xml document is picking up first five characters.<br />
correct me if am wrong view..</p>
<p>USE TempDB<br />
GO<br />
&#8211; Create TestTable<br />
CREATE TABLE MyTable (ID INT, MyText VARCHAR(MAX),newtext nvarchar(max))<br />
GO<br />
INSERT MyTable (ID, MyText, newtext )<br />
VALUES(1, REPLICATE(&#8217;1234567890&#8242;, 100), REPLICATE(&#8217;1234567890&#8242;, 100))<br />
GO<br />
&#8211; Select Data<br />
SELECT ID, MyText<br />
FROM MyTable<br />
GO<br />
&#8211; Using Left<br />
SELECT ID, LEFT(MyText, 10) MyText<br />
FROM MyTable<br />
GO<br />
&#8211; Set TextSize<br />
SET TEXTSIZE 5;<br />
SELECT ID, MyText,newtext<br />
FROM MyTable;<br />
SET TEXTSIZE 2147483647<br />
GO<br />
&#8211; Clean up<br />
DROP TABLE MyTable<br />
GO</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pinaldave</title>
		<link>http://blog.sqlauthority.com/2012/08/28/sql-server-a-brief-note-on-set-textsize/#comment-338297</link>
		<dc:creator><![CDATA[pinaldave]]></dc:creator>
		<pubDate>Tue, 28 Aug 2012 09:58:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20468#comment-338297</guid>
		<description><![CDATA[Good Point Manoj,

I meant it for SSMS only but having your comment here complements the original blog post.]]></description>
		<content:encoded><![CDATA[<p>Good Point Manoj,</p>
<p>I meant it for SSMS only but having your comment here complements the original blog post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel K</title>
		<link>http://blog.sqlauthority.com/2012/08/28/sql-server-a-brief-note-on-set-textsize/#comment-338241</link>
		<dc:creator><![CDATA[Daniel K]]></dc:creator>
		<pubDate>Tue, 28 Aug 2012 06:48:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20468#comment-338241</guid>
		<description><![CDATA[In addition what Pinal said, the only difference between &#039;TEXTSIZE&#039; and &#039;LEFT&#039; i can think of is that you can query &#039;TEXTSIZE&#039; with &#039;select @@TEXTSIZE&#039; where you can retrieve the integer value of the global variable. 

Maybe you can use it for stored procs and such. I usually don&#039;t use &#039;TEXTSIZE&#039;.

Cheers,
Daniel]]></description>
		<content:encoded><![CDATA[<p>In addition what Pinal said, the only difference between &#8216;TEXTSIZE&#8217; and &#8216;LEFT&#8217; i can think of is that you can query &#8216;TEXTSIZE&#8217; with &#8216;select @@TEXTSIZE&#8217; where you can retrieve the integer value of the global variable. </p>
<p>Maybe you can use it for stored procs and such. I usually don&#8217;t use &#8216;TEXTSIZE&#8217;.</p>
<p>Cheers,<br />
Daniel</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pankaj</title>
		<link>http://blog.sqlauthority.com/2012/08/28/sql-server-a-brief-note-on-set-textsize/#comment-338220</link>
		<dc:creator><![CDATA[Pankaj]]></dc:creator>
		<pubDate>Tue, 28 Aug 2012 05:49:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20468#comment-338220</guid>
		<description><![CDATA[Hi Pinal,
Just similar question I have related to difference between using TOP and SET ROWCOUNT. Even if they give similar result is there any difference in performance.]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,<br />
Just similar question I have related to difference between using TOP and SET ROWCOUNT. Even if they give similar result is there any difference in performance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: manub22</title>
		<link>http://blog.sqlauthority.com/2012/08/28/sql-server-a-brief-note-on-set-textsize/#comment-338218</link>
		<dc:creator><![CDATA[manub22]]></dc:creator>
		<pubDate>Tue, 28 Aug 2012 05:44:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=20468#comment-338218</guid>
		<description><![CDATA[Hi Pinal,

Both of them are not same and do not give same result.

They are different only for the SSMS text editor, but not for the Query Engine.

Check this:


-- Using Left
SELECT ID, LEFT(MyText, 10) MyText
into #temp1
FROM MyTable
GO

-- Set TextSize
SET TEXTSIZE 10;
SELECT ID, MyText
into #temp2
FROM MyTable;
SET TEXTSIZE 2147483647
GO

select * from #temp1
select * from #temp2
GO

You won&#039;t get same number of character in both the table&#039;s columns.]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>Both of them are not same and do not give same result.</p>
<p>They are different only for the SSMS text editor, but not for the Query Engine.</p>
<p>Check this:</p>
<p>&#8211; Using Left<br />
SELECT ID, LEFT(MyText, 10) MyText<br />
into #temp1<br />
FROM MyTable<br />
GO</p>
<p>&#8211; Set TextSize<br />
SET TEXTSIZE 10;<br />
SELECT ID, MyText<br />
into #temp2<br />
FROM MyTable;<br />
SET TEXTSIZE 2147483647<br />
GO</p>
<p>select * from #temp1<br />
select * from #temp2<br />
GO</p>
<p>You won&#8217;t get same number of character in both the table&#8217;s columns.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
