Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Lastname layout made proper

Author  Topic 

peter@KLM
Starting Member

6 Posts

Posted - 2007-07-23 : 11:24:21
I have a database for mailing purpose with the lastname in uppercase only.
I like to change the layout of the Lastname to a proper version
E.G.

VANDEVENNE HAVERMANS
changed into
Vandevenne Havermans


Ofcourse names could exists of more parts and prefixes on the second name should not be handled (made uppercase for first character)

The prefixes are stored in a separate table, so they can be easely traced.

I think I'll need some kind of loop but i dont know how to do it right.
Can someone help me, please

Kind regards
Peter

sshelper
Posting Yak Master

216 Posts

Posted - 2007-07-23 : 11:27:56
You can try the function defined in the following link, which capitalizes the first character of each string:

http://www.sql-server-helper.com/functions/initcap.aspx

SQL Server Helper
http://www.sql-server-helper.com
Go to Top of Page

peter@KLM
Starting Member

6 Posts

Posted - 2007-07-23 : 11:35:03
Hi SSHELPER

Thank you for the fast reply.
one more question:
how do I invoke the function in my table processing.
This may sound stupid, but I never invoked a user-function before in my processing
Go to Top of Page

sshelper
Posting Yak Master

216 Posts

Posted - 2007-07-23 : 13:05:33
You invoke the user-defined function just like any other function:

SELECT [dbo].[InitCap] ( [FullName] ) AS [FullName]
FROM YourTable

SQL Server Helper
http://www.sql-server-helper.com
Go to Top of Page
   

- Advertisement -