You will receive below error when you try to ORDER BY or GROUP BY a column with data type Image, Text, Ntext.
Msg 306, Level 16, State 2, Line 23
The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.
Image – Data type is used for storing variable length binary data.
Ntext – Data type is used for storing variable length of Unicode data.
Text – Data types is used for storing variable length non-Unicode data.
The image, text and ntext, data type columns cannot be compared or sorted, except when using IS NULL or LIKE operator.
The solution for this type of error is to convert Image column to VarBinary, Text column to VarChar and Ntext column to nVarChar when you use these columns in ORDER BY or GROUP BY clause.
Example for GROUP BY clause:
SELECT * FROM dbo.CustomerMaster GROUP BY CustomerType;
Modify the query as
SELECT * FROM dbo.CustomerMaster GROUP BY CAST (CustomerType as nvarchar)
Example for ORDER BY clause:
SELECT * FROM dbo.CustomerMaster ORDER BY CustomerName;
Modify the query as
SELECT * FROM dbo.CustomerMaster ORDER BY CAST(CustomerName as nVarChar)
Msg 306, Level 16, State 2, Line 23
The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.
Image – Data type is used for storing variable length binary data.
Ntext – Data type is used for storing variable length of Unicode data.
Text – Data types is used for storing variable length non-Unicode data.
The image, text and ntext, data type columns cannot be compared or sorted, except when using IS NULL or LIKE operator.
The solution for this type of error is to convert Image column to VarBinary, Text column to VarChar and Ntext column to nVarChar when you use these columns in ORDER BY or GROUP BY clause.
Example for GROUP BY clause:
SELECT * FROM dbo.CustomerMaster GROUP BY CustomerType;
Modify the query as
SELECT * FROM dbo.CustomerMaster GROUP BY CAST (CustomerType as nvarchar)
Example for ORDER BY clause:
SELECT * FROM dbo.CustomerMaster ORDER BY CustomerName;
Modify the query as
SELECT * FROM dbo.CustomerMaster ORDER BY CAST(CustomerName as nVarChar)
Balıkesir
ReplyDeleteBursa
Mersin
Konya
Van
DQL
whatsapp görüntülü show
ReplyDeleteücretli.show
HRU
görüntülü.show
ReplyDeletewhatsapp ücretli show
EİİDO
ankara parça eşya taşıma
ReplyDeletetakipçi satın al
antalya rent a car
antalya rent a car
ankara parça eşya taşıma
6B0LCR
E78AB
ReplyDeletediyarbakır goruntulu sohbet
en iyi ücretsiz sohbet uygulamaları
Hatay Canlı Görüntülü Sohbet
ısparta görüntülü canlı sohbet
Antalya Ücretsiz Sohbet
Diyarbakır Ücretsiz Sohbet Odaları
Tekirdağ Ücretsiz Sohbet Uygulamaları
tunceli yabancı sohbet
Sinop Rastgele Görüntülü Sohbet Uygulamaları
BC853
ReplyDeletesinop yabancı görüntülü sohbet
kadınlarla ücretsiz sohbet
Amasya Canlı Sohbet Siteleri Ücretsiz
rastgele sohbet odaları
Karabük Bedava Görüntülü Sohbet
kars telefonda kadınlarla sohbet
adıyaman telefonda görüntülü sohbet
çorum kızlarla rastgele sohbet
görüntülü sohbet siteleri