Skip to main content
added 5 characters in body
Source Link
Paul White
  • 90.3k
  • 30
  • 424
  • 663

I do want to capitalize only the first letter of each word of each sentence fromin a SQL column.

i.e:For example, if the sentancesentence is:

'I like movies'

then I need the output:

'I Like Movies'

Query:

declare @a varchar(15) 

set @a = 'qWeRtY kEyBoArD'

select @a as [Normal text],
upper(@a) as [Uppercase text],
lower(@a) as [Lowercase text],
upper(left(@a,1)) + lower(substring(@a,2,len(@a))) as [Capitalize first letter only]

Here I did upper, lower, and Capitalizecapitalize first letter only in my fieldcolumn (here I put just a random word).

Here isare my results:

enter image description here

Is there any possibilities to do that?

Any possibilities to get results without using user defined function?

I need the output Qwerty Keyboard

I do want to capitalize only the first letter of each word of each sentence from a SQL column.

i.e: if the sentance is

'I like movies'

then I need the output

'I Like Movies'

Query:

declare @a varchar(15) 

set @a = 'qWeRtY kEyBoArD'

select @a as [Normal text],
upper(@a) as [Uppercase text],
lower(@a) as [Lowercase text],
upper(left(@a,1)) + lower(substring(@a,2,len(@a))) as [Capitalize first letter only]

Here I did upper, lower and Capitalize first letter only in my field(here I put just a random word).

Here is my results:

enter image description here

Is there any possibilities to do that?

Any possibilities to get results without using user defined function?

I need the output Qwerty Keyboard

I want to capitalize only the first letter of each word of each sentence in a SQL column.

For example, if the sentence is:

'I like movies'

then I need the output:

'I Like Movies'

Query:

declare @a varchar(15) 

set @a = 'qWeRtY kEyBoArD'

select @a as [Normal text],
upper(@a) as [Uppercase text],
lower(@a) as [Lowercase text],
upper(left(@a,1)) + lower(substring(@a,2,len(@a))) as [Capitalize first letter only]

Here I did upper, lower, and capitalize first letter only in my column (here I put just a random word).

Here are my results:

enter image description here

Is there any possibilities to do that?

Any possibilities to get results without using user defined function?

I need the output Qwerty Keyboard

edited tags
Link
Paul White
  • 90.3k
  • 30
  • 424
  • 663
Tweeted twitter.com/StackDBAs/status/735892307090755584
edited title
Link

Capitalize only the first letter of each word of each sentence in SQL SQL Server

added 54 characters in body
Source Link
Loading
added 78 characters in body
Source Link
Loading
added 78 characters in body
Source Link
Loading
Source Link
Loading