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.
Author |
Topic |
sqlbeginner123
Starting Member
9 Posts |
Posted - 2013-05-02 : 12:28:23
|
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_addrfrom 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 <> -1and 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 tranUPDATE AddrSET sAddr1 = RTRIM(sAddr1)+' '+'Drive'FROM ADDR AINNER JOIN UNIT U ON U.hmy = A.hPointerAND a.itype=4WHERE u.hproperty=propcode AND u.exclude<>-1 AND a.saddr1 LIKE '%CHARLES'Thank you in advance for your help! |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-05-03 : 03:06:45
|
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 MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-05-03 : 08:58:15
|
Did you forget to add what you wanted to say after the quoted text? Or is the problem still unresolved? |
|
|
sqlbeginner123
Starting Member
9 Posts |
Posted - 2013-05-03 : 09:00:15
|
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 |
|
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-05-03 : 09:02:48
|
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 MVPhttp://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. |
|
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-05-03 : 09:03:41
|
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 :) |
|
|
econvertcase
Starting Member
1 Post |
Posted - 2013-08-15 : 05:28:28
|
Good work thanks for sharing this best convert case Post |
|
|
|
|
|