Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 text V.S varchar

Author  Topic 

shebert
Yak Posting Veteran

85 Posts

Posted - 2009-07-24 : 12:46:16
I have a DB running in sql 2005, but compatibility mode 8.0

I have a text field in table YNOT called comments

i want to do a distinct select from YNOT so I convert "comments" to varchar(500).

is Varchar(500) valid? how big can I make it Varchar(5000)?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-07-24 : 12:51:15
varchar(8000) is maximum in compatibility 80. however text can handle more than that so you need to make sure you dont have data with more than 8000 chars in text field to avoid value truncation.
Go to Top of Page

shebert
Yak Posting Veteran

85 Posts

Posted - 2009-07-24 : 13:01:45
do you know of any way to find the largest comment record?
like
select max(comment) from YNOT
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-07-24 : 13:05:45
[code]select comment,DATALENGTH(comment) as collen from YNOT ORDER BY collen DESC[/code]
Go to Top of Page
   

- Advertisement -