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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 count text column?

Author  Topic 

kwikwisi
Constraint Violating Yak Guru

283 Posts

Posted - 2008-04-13 : 23:21:50
when i count desc column (datatype=nvarchar),no error found
but now i change desc column(datatype=text),i've got error
how can i count text column??

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-04-13 : 23:32:16
What do you mean count text column? What was the error?
Go to Top of Page

kwikwisi
Constraint Violating Yak Guru

283 Posts

Posted - 2008-04-13 : 23:38:55
i want to count column and the datatype of this column is text.
previously i set the data type of this column "nvchar".
but now i change the data type "text".
i've got error like that:"the types ntext,text,image data types are invalid in this sub query and aggregate expression"
what's wrong?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-14 : 00:12:47
You cant apply COUNT() function on text,ntext,image datatypes. Why are you using text datatype? What are holding in the column as values?
Go to Top of Page

kwikwisi
Constraint Violating Yak Guru

283 Posts

Posted - 2008-04-14 : 01:15:17
hi
now i already ok coz i use another column instead of that text column
thanks
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-04-14 : 02:34:15
quote:
Originally posted by visakh16

You cant apply COUNT() function on text,ntext,image datatypes. Why are you using text datatype? What are holding in the column as values?

A workaround can be

SELECT SUM(CASE WHEN TextCol IS NULL THEN 0 ELSE 1 END)
FROM Table



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -