January 16, 2008 at 7:50 am
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
January 16, 2008 at 8:34 am
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
January 18, 2008 at 9:58 am
how do I change this if I am on SQL Sewrver 2000? I am a little confused?
January 18, 2008 at 10:08 am
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
January 18, 2008 at 11:05 am
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