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 |
madamvegas
Starting Member
3 Posts |
Posted - 2012-05-10 : 14:16:39
|
Converting an access db to sql and there is a function called StrConv which can convert the first letter of each word to uppercase. I checked to see if there was a corresponding function in sql and didn't find one. Is there an easy way to do this?Very new to sql so trying to get into using the easist stuff I can so I can understand what I am doing whether than just copying someone's code.thanksTheresa Burk |
|
jsmith8858
Dr. Cross Join
7423 Posts |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-05-10 : 14:49:40
|
Its always better to do this at front end wherever possible as its a presentation issue------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2012-05-10 : 14:59:00
|
quote: Originally posted by visakh16 Its always better to do this at front end wherever possible as its a presentation issue------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
Normally I agree, it depends if this is a data cleaning/converting exercise or a reporting/presentation issue. I'd suggest making it a conversion exercise because it is nearly impossible to properly format all variations of text into perfect proper case using a function "on the fly" during the presentation process, plus it might not be efficient or even possible to convert that data at every database access point.- Jeffhttp://weblogs.sqlteam.com/JeffS |
|
|
vijays3
Constraint Violating Yak Guru
354 Posts |
Posted - 2012-05-10 : 17:50:10
|
quote: Originally posted by madamvegas Converting an access db to sql and there is a function called StrConv which can convert the first letter of each word to uppercase. I checked to see if there was a corresponding function in sql and didn't find one. Is there an easy way to do this?Very new to sql so trying to get into using the easist stuff I can so I can understand what I am doing whether than just copying someone's code.thanksTheresa Burk
check this out declare @a varchar(20)set @a = 'vijay'select @a, upper(SUBSTRING(@a,1,1)) as firstc,SUBSTRING(@a,2,len(@a))as remainig,upper(SUBSTRING(@a,1,1))+''+SUBSTRING(@a,2,len(@a)) |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2012-05-14 : 07:27:42
|
quote: Originally posted by vijays3
quote: Originally posted by madamvegas Converting an access db to sql and there is a function called StrConv which can convert the first letter of each word to uppercase. I checked to see if there was a corresponding function in sql and didn't find one. Is there an easy way to do this?Very new to sql so trying to get into using the easist stuff I can so I can understand what I am doing whether than just copying someone's code.thanksTheresa Burk
check this out declare @a varchar(20)set @a = 'vijay'select @a, upper(SUBSTRING(@a,1,1)) as firstc,SUBSTRING(@a,2,len(@a))as remainig,upper(SUBSTRING(@a,1,1))+''+SUBSTRING(@a,2,len(@a))
This will only change the first letter of first word to capital. But the question is about changing it for each word.Here is another methodhttp://beyondrelational.com/modules/2/blogs/70/posts/10901/tsql-initcap-function-convert-a-string-to-proper-case.aspxMadhivananFailing to plan is Planning to fail |
|
|
|
|
|
|
|