I have problem with query when I use distinct I got text type cannot be selected as distinct
so what is the different if I change it to varchar
please help
Thanks
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Bikesh SrivastavaRank #108 · 20.3K reputationPosted Aug 8, 2016, 2:42 AM EDT
The
VARCHAR(MAX)type is a replacement forTEXT. The basic difference is that aTEXTtype will always store the data in a blob whereas theVARCHAR(MAX)type will attempt to store the data directly in the row unless it exceeds the 8k limitation and at that point it stores it in a blob.Using the LIKE statement is identical between the two datatypes. The additional functionality
VARCHAR(MAX)gives you is that it is also can be used with=andGROUP BYas any otherVARCHARcolumn can be. However, if you do have a lot of data you will have a huge performance issue using these methods.In regard to if you should use
LIKEto search, or if you should use Full Text Indexing andCONTAINS. This question is the same regardless ofVARCHAR(MAX)orTEXT.If you are searching large amounts of text and performance is key then you should use a Full Text Index.
LIKEis simpler to implement and is often suitable for small amounts of data, but it has extremely poor performance with large data due to its inability to use an index.Manas MohapatraRank #182 · 13.2K reputationPosted Aug 8, 2016, 2:43 AM EDT
Midhun TpRank #388 · 6.5K reputationPosted Aug 8, 2016, 2:43 AM EDT
Joma Rajab125 reputationPosted Aug 8, 2016, 3:23 AM EDT