Click here to Skip to main content
15,919,479 members
Home / Discussions / Database
   

Database

 
AnswerRe: tow stored procedure Pin
_AK_4-Sep-06 23:19
_AK_4-Sep-06 23:19 
GeneralRe: tow stored procedure Pin
yazan_zahi4-Sep-06 23:26
yazan_zahi4-Sep-06 23:26 
GeneralRe: tow stored procedure Pin
_AK_5-Sep-06 3:16
_AK_5-Sep-06 3:16 
QuestionSet field to "Allow Zero Length" Pin
myNameIsRon4-Sep-06 22:36
myNameIsRon4-Sep-06 22:36 
QuestionWrite XML File Using SQL Server 2000 Pin
FriendlySoluations4-Sep-06 21:41
FriendlySoluations4-Sep-06 21:41 
AnswerRe: Write XML File Using SQL Server 2000 Pin
Marek Grzenkowicz4-Sep-06 22:55
Marek Grzenkowicz4-Sep-06 22:55 
QuestionSystem.ArgumentException in accesing data from DatagridView Pin
Rocky#4-Sep-06 20:49
Rocky#4-Sep-06 20:49 
QuestionThe text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator. Pin
uwhockey4-Sep-06 10:10
uwhockey4-Sep-06 10:10 
Hello,

I am trying to do a query from 2 tables, which I have done million of times before, but I haven't been able to find a solution to this error - where I resolved in other cases but in this case ran out of ideas:

"The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator."
Here is sp:

SELECT
tc.TXT_CTR_NUMERO_SGF,
REPLACE (tc.DEC_CTR_VLR_PI , ',' , '.') + REPLACE (tc.DEC_CTR_VLR_ADITIVO , ',' , '.') AS Total_PI_ADIT,
convert(varchar(30), Sum(convert(decimal(20,2), REPLACE(mr.DEC_MDR_VLR_PI, ',' , '.')))) VALOR_MEDIDO,

tc.COD_ID_CTR,
tc.COD_ID_TOB,
tc.DEC_CTR_VLR_SALDO_MEDIDO
FROM
tbContrato tc
LEFT JOIN tbMedicaoResumo mr
ON tc.COD_ID_CTR = mr.COD_ID_CTR
GROUP BY
tc.TXT_CTR_NUMERO_SGF, tc.DEC_CTR_VLR_PI, tc.DEC_CTR_VLR_ADITIVO,
tc.COD_ID_CTR, tc.COD_ID_TOB, tc.DEC_CTR_VLR_SALDO_MEDIDO


I have tried to convert all the text, nvarchar, etc to varchar and used like instead of =, but the problem seems to be with the grouping part!



A solution would be greatly appreciated.

Reza
AnswerRe: The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator. Pin
Marek Grzenkowicz4-Sep-06 23:02
Marek Grzenkowicz4-Sep-06 23:02 
GeneralRe: The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator. Pin
uwhockey5-Sep-06 5:20
uwhockey5-Sep-06 5:20 
GeneralRe: The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator. Pin
Member 965-Sep-06 6:51
Member 965-Sep-06 6:51 
QuestionMigrating SQL server 2000 database to SQL server 2005 with Japanese alphabets Pin
VaibhavJ4-Sep-06 4:38
VaibhavJ4-Sep-06 4:38 
Questionlayout query Pin
srinandan..4-Sep-06 2:06
srinandan..4-Sep-06 2:06 
AnswerRe: layout query Pin
SeMartens4-Sep-06 2:32
SeMartens4-Sep-06 2:32 
GeneralRe: layout query Pin
srinandan..4-Sep-06 2:40
srinandan..4-Sep-06 2:40 
QuestionWhich one's the best----Relational or non-relational DB structure? Pin
kamalika_kk4-Sep-06 0:07
kamalika_kk4-Sep-06 0:07 
AnswerRe: Which one's the best----Relational or non-relational DB structure? Pin
Colin Angus Mackay4-Sep-06 0:51
Colin Angus Mackay4-Sep-06 0:51 
GeneralRe: Which one's the best----Relational or non-relational DB structure? Pin
Paul Conrad4-Sep-06 7:18
professionalPaul Conrad4-Sep-06 7:18 
Questionsql 2000 installing problem Pin
yazan_zahi3-Sep-06 22:27
yazan_zahi3-Sep-06 22:27 
AnswerRe: sql 2000 installing problem Pin
yahao9-Oct-06 23:58
yahao9-Oct-06 23:58 
Questionmod div Pin
TAREQ F ABUZUHRI3-Sep-06 22:02
TAREQ F ABUZUHRI3-Sep-06 22:02 
AnswerRe: mod div Pin
Eric Dahlvang5-Sep-06 3:23
Eric Dahlvang5-Sep-06 3:23 
QuestionUpgrading an SQL Database via one click Pin
Martin J Evans3-Sep-06 22:02
Martin J Evans3-Sep-06 22:02 
AnswerRe: Upgrading an SQL Database via one click Pin
Eric Dahlvang5-Sep-06 3:20
Eric Dahlvang5-Sep-06 3:20 
Questionhow to (stored procedures) Pin
yazan_zahi2-Sep-06 22:28
yazan_zahi2-Sep-06 22:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.