SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Convert Case to Proper
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sqlbeginner123
Starting Member

9 Posts

Posted - 05/02/2013 :  12:28:23  Show Profile  Reply with Quote
Good Afternoon, please help I have an address field in my database and I need to convert the data from Upper case to proper. Does anyone have an easy way to do this. Here is my select statement.

elect
rtrim(p.scode) pscode,
u.scode uscode,
rtrim(ad.sAddr1) u_addr
from property p
inner join unit u on (p.HMY = u.hproperty)
left outer join ADDR ad on (ad.HPOINTER = u.HMY and ad.ITYPE = 4)
where u.HPROPERTY = 'propcode'
and u.exclude <> -1
and ad.SADDR1 like '%CHARLES%'

Here is my initial update statement because I also need to be able to add in "steet, drive, ect... but how do I go about making the street name proper case first?

begin tran
UPDATE Addr
SET sAddr1 = RTRIM(sAddr1)+' '+'Drive'
FROM ADDR A
INNER JOIN UNIT U ON U.hmy = A.hPointer
AND a.itype=4
WHERE u.hproperty=propcode
AND u.exclude<>-1
AND a.saddr1 LIKE '%CHARLES'


Thank you in advance for your help!

James K
Flowing Fount of Yak Knowledge

3724 Posts

Posted - 05/02/2013 :  12:31:04  Show Profile  Reply with Quote
I have not tried the method in this blog, but I have seen other people refer to it. Take a look: http://beyondrelational.com/modules/2/blogs/70/posts/10901/tsql-initcap-function-convert-a-string-to-proper-case.aspx
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 05/03/2013 :  03:06:45  Show Profile  Reply with Quote
Why should you do this change in database?
SQL Server under default collation is case insensitive so if this is just for display purpose you may be better off doing this at front end application

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3724 Posts

Posted - 05/03/2013 :  08:58:15  Show Profile  Reply with Quote
Did you forget to add what you wanted to say after the quoted text? Or is the problem still unresolved?
Go to Top of Page

sqlbeginner123
Starting Member

9 Posts

Posted - 05/03/2013 :  09:00:15  Show Profile  Reply with Quote
The change is needed in the database it's not just for display purposes. There is too much data to try and make the change directly in the database itself it would be easier and less time consuming if there is a way to make the change in SQL to the database.

Thank you
Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3724 Posts

Posted - 05/03/2013 :  09:02:48  Show Profile  Reply with Quote
quote:
Originally posted by visakh16

Why should you do this change in database?
SQL Server under default collation is case insensitive so if this is just for display purpose you may be better off doing this at front end application

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs


There can be a number of reasons for doing this - everything from having no front end application, or having only a thin client front end. Even in case insensitive collations, while logical comparisons are case insensitive, the storage itself is case sensitive.
Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3724 Posts

Posted - 05/03/2013 :  09:03:41  Show Profile  Reply with Quote
quote:
Originally posted by James K

Did you forget to add what you wanted to say after the quoted text? Or is the problem still unresolved?

I knew I should have quoted you before I posted this :)
Go to Top of Page

econvertcase
Starting Member

USA
1 Posts

Posted - 08/15/2013 :  05:28:28  Show Profile  Reply with Quote
Good work thanks for sharing this best convert case Post
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000