• Hi,

    I'm not sure what your GetNums function looks like. I used the DelimitedSplit8K which you can find in the following article which explains how it works. http://www.sqlservercentral.com/articles/Tally+Table/72993

    Here's my option for you that seems to be doing what you need.

    CREATE FUNCTION [dbo].[ProperCase]

    (

    @StrIn VARCHAR(255)

    )

    RETURNS TABLE WITH SCHEMABINDING

    AS

    RETURN

    SELECT STUFF((SELECT ' ' + UPPER( LEFT( split.Item, 1)) + LOWER(SUBSTRING( split.Item, 2, 255)) word

    FROM dbo.DelimitedSplit8K( @StrIn, ' ') split

    FOR XML PATH(''),TYPE).value('.', 'varchar(255)'), 1, 1, '') AS ProperCased

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2