TMSUSERS Archives

The Museum System (TMS) Users

TMSUSERS@SI-LISTSERV.SI.EDU

Options: Use Monospaced Font
Show HTML Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Churchman, John" <[log in to unmask]>
Reply To:
The Museum System (TMS) Users
Date:
Fri, 30 Nov 2012 11:10:23 -0500
Content-Type:
multipart/alternative
Parts/Attachments:
text/plain (2759 bytes) , text/html (12 kB)
If you  are doing one record at a time, you can copy and paste the text into Word and see the Word count at the bottom of the screen. (If you do not see the word count, right-click the status bar at the bottom and check Word Count.)

If you want to get a word count for many records, you could try this function taken from the web:
T-SQL function to get word count<http://www.websolete.com/posts/t-sql-function-to-get-word-count>
Posted by Kevin J. Miller in SQL Server<http://www.websolete.com/archives/category/sql-server> on November 18, 2008
Similar in approach to the previous uf_charCount function, the following function returns the number of words in a string, assuming a space token as word separator.
CREATE FUNCTION [dbo].[uf_wordCount] (@string varchar(8000))
RETURNS SMALLINT
/*
        Purpose: returns the number of words in @string
        Author: Kevin J. Miller (www.websolete.com)

        Example:
               SELECT dbo.uf_wordCount('four score and seven years ago')
               would return: 6

*/
AS
BEGIN
        SET @string = LTRIM(RTRIM(ISNULL(@string,'')));
        IF LEN(@string) = 0 RETURN 0;
        -- return the difference in length after stripping spaces, this is the word count
        RETURN ((LEN(@string) + 1) - LEN(REPLACE(@string,' ','')));
END

<http://www.websolete.com/posts/t-sql-function-to-get-word-count#tab-1>

Note, however, that if you are running this function against a text field you will first need to Cast or Convert it to a VARCHAR field not exceeding 8000 characters; if your text fields exceed this length the function will not work.

John Churchman
Office of the Chief Information Officer
Smithsonian Institution
Work: 202-633-0619
Cell:   703-300-6574

From: The Museum System (TMS) Users [mailto:[log in to unmask]] On Behalf Of Ella Rothgangel
Sent: Friday, November 30, 2012 10:50 AM
To: [log in to unmask]
Subject: field word count

Has anyone found a way to count the number of words in a field?  Either a large text field or text entries is fine.  I have curators interested in composing label copy in tms, but I need to have an answer to the word count hurdle.

Thanks,

Ella



Ella Rothgangel
Collections Information & Imaging Administrator
Saint Louis Art Museum
One Fine Arts Drive, Forest Park
St. Louis, Missouri  63110
314.655.5408

To unsubscribe, send an email to [log in to unmask]<mailto:[log in to unmask]> with the following commands in the body of the email:

signoff TMSUSERS

// eoj

You will receive a confirmation that your subscription has been removed.

To unsubscribe, send an email to [log in to unmask] with the following commands in the body of the email:

     signoff TMSUSERS

     //  eoj


You will receive a confirmation that your subscription has been removed.


ATOM RSS1 RSS2