Count the characters in a datatable

Posted by Nishithraj under Regular Expressions on 2/4/2010 | Views : 1383 | Status : [Member] | Replies : 5
I need to count the characters in each rows of a data table without null values.(i.e blank spaces between the words, first or last)

If the count is more than some 900 character I need to show that rows to the user as "the limit has exceeded".

How can we do this?

Mark this as answer, if it is.....

With regards
Nishithraj Narayanan



Responses

Posted by: Vuyiswamb on: 2/4/2010 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Good Day Nishithraj

You want to Count the Number of Characters in a Field in your Table and if its more that 900 you want to show that Row?

Thank you for posting at Dotnetfunda
[Administrator]

Nishithraj, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Neeks on: 2/4/2010 [Member] Bronze

Up
0
Down
You can achieve this functionality by using the length of the string

SELECT * FROM TableName
WHERE DATALENGTH(ColumnName) > 900

If still any problem to get the desired output let us know.

Nishithraj, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Neeks on: 2/4/2010 [Member] Bronze

Up
0
Down
You can achieve this functionality by using the length of the string

SELECT * FROM TableName
WHERE LEN(ColumnName) > 900

If still any problem to get the desired output let us know.

Nishithraj, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nishithraj on: 2/5/2010 [Member] Bronze

Up
0
Down
Hi Vuyiswamb,

I hope you are doing well now.


The requirement is like follows..

Actually I have a data table(It's data table object in ADO.NET, not the table of database) with some rows like score and comments. I need to check the length of the string without blankspaces in each comments. If it is more than 900 I need to show that in a data grid.(only that exceeded rows)

I guess it's clear now.


Mark this as answer, if it is.....

With regards
Nishithraj Narayanan

Nishithraj, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Neeks on: 2/5/2010 [Member] Bronze

Up
0
Down
This might help you

SELECT * FROM TableName
WHERE LEN(Replace(ColumnName, ' ', '')) > 900

Please let me know for further clarification.

Thanks...

Nishithraj, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response