February 14, 2011 at 4:24 pm
Hi everybody, I want to count all characters(numbers, letters) from my table...someone know the way of do it this.
Thanks for your help!
February 14, 2011 at 5:55 pm
Lisset (2/14/2011)
Hi everybody, I want to count all characters(numbers, letters) from my table...someone know the way of do it this.Thanks for your help!
What do you want to count for things like the INTEGER datatype?
We really need a bit more information as to what you actually want to do and why. We need to know "why" so we can give you the best solution one of which may already exist in SQL Server itself.
--Jeff Moden
Change is inevitable... Change for the better is not.
February 14, 2011 at 11:31 pm
Assuming the most simplest requirement, something like the following?
SELECT SUM(SUM(LEN(Field_A)) + SUM(LEN(Field_B)) + SUM(LEN(Field_C)))
FROM Table_X
February 15, 2011 at 9:50 am
Thanks diamondgm! The solution was:
select sum(len(ltrim(rtrim(replace(Column1,' ',''))))+len(ltrim(rtrim(replace(Column1,' ',''))))
from table
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply