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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Bikesh SrivastavaPosted Aug 8, 2016, 6:42 AM
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.Joma RajabPosted Aug 8, 2016, 7:23 AM
Midhun TpPosted Aug 8, 2016, 6:43 AM
Manas MohapatraPosted Aug 8, 2016, 6:43 AM