>>Script Language and Platform: SQL Server
This script can change any string to “Title Case” (i.e: 1st letter of each word in the parameter is capitalised, and subsequent letters of each word are made to lower case)
For Example: “HeLLo wOrlD” would be outputted as “Hello World” using this function.
FAQs:
=====
How to create this function in SQL Server:
- Run SQL Enterprise Manager.
- Expand as following:
Microsoft SQL Servers -> “Your Group” -> “your Server” -> Databases -> “your database” -> User Defined Functions - Right click on “User Defined Functions” and select “New User Defined Function” from the popup menu.
- In the box that appears cut and paste the downloadable script as given.
How to use this function in SQL Server:
Select fn_TitleCase(‘HeLLo wOrlD’)
or
Select dbo.fn_TitleCase(‘HeLLo wOrlD’)
You should get the output as Hello World.
Author: PK
Download Script:
fn_TitleCase.sql
Disclaimer: We hope that the information on these script pages is
valuable to you. Your use of the information contained in these pages,
however, is at your sole risk. All information on these pages is provided
“as -is”, without any warranty, whether express or implied, of its accuracy,
completeness, or fitness for a particular purpose…
Disclaimer Continued
Back to Database Journal Home