Change Data in acolumn to Name Case

  • I have some data in a table that during a conversion we put in all lower and in all upper case. Thise is a name column in the table so it need to be Firstname M. Lastname, or just Firstname or Firstname Lastname. Does anyone have any scriptor help they can give me on how to do this. I am using SQL Server.

    Thanks in Advance..

    Kipp

  • there is a function called Propercase in the script contributions section.

    with that function installed, you could then simply do an update:

    UPDATE SomeTable

    SET NameColumn = dbo.Propercase(NameColumn)

    Proper Case A String Or Name - SQL Server CentralFree Microsoft SQL Server articles, news, forums, scripts and FAQs.

    http://www.sqlservercentral.com/scripts/Miscellaneous/31880/

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • how do I change this if I am on SQL Sewrver 2000? I am a little confused?

  • doesn't matter which version of SQL; the script at that link is 2000/2005 compatible.

    download the script form the link I posted...it's basically CREATE FUNCTION ProperCase AS....

    open SQL Query Analyzer, connect, and change to the same database that the data exists that you want to fix.

    paste the script in QA and press F5 in order to install the function.

    test the script by modifying this SELECT statemetn to see how well it would work. EXAMINE THE RESULTS!!!!

    SELECT NameColumn, dbo.Propercase(NameColumn) As FixedColumn from SomeTable

    if the results look teh way you like, then you can modify the update statemnt above...without a WHERE statment, it will update EVERY COLUMN in the table...you need to decide whether that is really what you want.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • hey thanks I appreciate the help

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply