Category: SQL Server

T-SQL function to get word count

11/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.

Read more...


Posted by Kevin J. Miller in:SQL Server

T-SQL function to get a char count

11/18/2008

I needed an efficient and reusable way to get character counts in strings at the database level and produced the following udf which takes a string and a character and returns the number of occurrences of the character in the string.

Read more...


Posted by Kevin J. Miller in:SQL Server

CF-style List functions in SQL Server

11/11/2008

The built-in string handling functions in t-sql are all well and good, but there really aren't any graceful ways of handling lists.  As any CF developer that's been around a while knows, lists are pretty commonplace in practice, and there are times when it makes more sense (or you're required) to do list handling at the db level rather than at the front end.

The following three SQL Server udf's provide equivalent functionality to the ColdFusion list functions listfirst, listgetat, and listlast.

Read more...


Posted by Kevin J. Miller in:SQL Server