Mark Harris
Proper Case in SQL
First up Proper Case is really Title Case. And if you ever need to convert text to Title Case in SQL you can use Vyas Kondreddi’s PROPERCASE SQL script or David Wiesman’s PROPERCASE SQL script
My only change to their scripts would be to use NVARCHAR(MAX) or VARCHAR(MAX) as compared to their use of VARCHAR(8000), if your using SQL Server 2005 or above.
1: CREATE FUNCTION [dbo].[fProperCase]
2: (
3: @Value VARCHAR(8000),
4: @Exceptions VARCHAR(8000),
5: @UCASEWordLength TINYINT
6: )
7: RETURNS VARCHAR(8000)
8: AS
9: BEGIN
10: ...
11: END
So I would covert the above syntax when using SQL Server 2000 to the T-SQL below when using SQL Server 2005
1: CREATE FUNCTION [dbo].[fProperCase]
2: (
3: @Value VARCHAR(MAX),
4: @Exceptions VARCHAR(MAX),
5: @UCASEWordLength TINYINT
6: )
7: RETURNS VARCHAR(MAX)
8: AS
9: BEGIN
10: ...
11: END
Tagged with: Development • Proper Case • SQL Server • Sql String Case Conversion • Title Case • TSQL
Tags
.net .net4 Addins apple Biztalk BizTalk Express C# Caching cch harmony launch party Comic Development Dilbert distributed entity framework extensions firefox 3 flickr flickrlight General Go Live Rituals in memory iphone2 iphone 3g Linq To Sql MAF Managed Addin Framework Mapped Drive to UNC NServiceBus Oslo Plugins point case estimation project estimation Run As Administrator silverlight sky diving soa SQL Server Training UAC Velocity Vista Visual Studio wcf wf wwdc 2008




