Unix Technical Forum

text or varchar ?

This is a discussion on text or varchar ? within the SQL Server forums, part of the Microsoft SQL Server category; --> Hi, What is the maximum character a text type column can contain ? Can't change the length to upper ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 07:43 AM
Sam
 
Posts: n/a
Default text or varchar ?

Hi,
What is the maximum character a text type column can contain ? Can't
change the length to upper than 16....
What is the bigger ? Varchar(8000) or Text ?

Regards

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 07:43 AM
Stu
 
Posts: n/a
Default Re: text or varchar ?

Text is a actually a binary representation of data; it is virtually
unlimited in terms of the characters that can be inserted into.
However, you can run into some issues, as noted in the SQL Books
OnLine:

"If an ntext, text, and image data value is no longer than a Unicode,
character, or binary string (4,000 characters, 8,000 characters, 8,000
bytes respectively), the value can be referenced in SELECT, UPDATE, and
INSERT statements much the same way as the smaller data types. For
example, an ntext column with a short value can be referenced in a
SELECT statement select list the same way an nvarchar column is
referenced. Some restrictions that must be observed, such as not being
able to directly reference an ntext, text, or image column in a WHERE
clause. These columns can be included in a WHERE clause as parameters
of a function that returns another data type (such as ISNULL, SUBSTRING
or PATINDEX) or in an IS NULL, IS NOT NULL, or LIKE expression."

HTH, Stu

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-29-2008, 07:43 AM
Hugo Kornelis
 
Posts: n/a
Default Re: text or varchar ?

On 31 May 2005 08:53:53 -0700, Sam wrote:

>Hi,
>What is the maximum character a text type column can contain ? Can't
>change the length to upper than 16....
>What is the bigger ? Varchar(8000) or Text ?


Hi Sam,


The length you see for text columns in tools such as Enterprise Manager
is actually the length of a pointer. This pointer points to a seperate
location where the actual text is stored. The pointer is part of the
data row; the text itself is not. This keeps the data row small
(speeding up queries that dopn't use the text), but makes access to the
text slow (since another page has to be read).

The maximum length of a text value is 2 GB. (2,147,483,647 characters).

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:01 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com