Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text vs Varchar

Status
Not open for further replies.

notrut

Programmer
Joined
Feb 6, 2002
Messages
87
Location
CA
Hi,

What's the difference between using a 'text' datatype and a 'varchar' datatype in a table???

 
The difference is HUGE.
From BOL:
text

Variable-length non-Unicode data in the code page of the server and with a maximum length of 231-1 (2,147,483,647) characters. When the server code page uses double-byte characters, the storage is still 2,147,483,647 bytes. Depending on the character string, the storage size may be less than 2,147,483,647 bytes.

varchar[(n)]

Variable-length non-Unicode character data with length of n bytes. n must be a value from 1 through 8,000. Storage size is the actual length in bytes of the data entered, not n bytes. The data entered can be 0 characters in length. The SQL-92 synonyms for varchar are char varying or character varying
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top