Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 22, 2011 06:19 AM by iGulfam
Participant
1498 Points
581 Posts
Dec 22, 2011 06:09 AM|LINK
i am creating below query
select cast(replace(cast(Topic_name as nvarchar(max)),'_',' ') as ntext) as topic from tb_streak
This query replace the '_'(underscore) with the space( )
like bodmas_1 to bodmas 1
i need a more query with this query that will give me the output like Bodmas 1 (means first character in a uppercase)
how it can be possible or how i can replace the underscore with the space and first character in a uppercase
Plz help me...
Thankx..
Regards
Bharat Bhushan
All-Star
30571 Points
5848 Posts
Dec 22, 2011 06:16 AM|LINK
Hi,
create a function for that and use like...
http://www.codeproject.com/KB/database/sqlserver.aspx
Thanks...
Contributor
4794 Points
947 Posts
Dec 22, 2011 06:19 AM|LINK
Use following Query
SELECT REPLACE(UPPER(SUBSTRING(Topic_name, 1, 1))+LOWER(SUBSTRING(Topic_name, 2, LEN(Topic_name))), '_', ' ') AS topic FROM tb_streak
bhushan_bhar...
Participant
1498 Points
581 Posts
neeed a sql query
Dec 22, 2011 06:09 AM|LINK
i am creating below query
select cast(replace(cast(Topic_name as nvarchar(max)),'_',' ') as ntext) as topic
from tb_streak
This query replace the '_'(underscore) with the space( )
like bodmas_1 to bodmas 1
i need a more query with this query that will give me the output like Bodmas 1 (means first character in a uppercase)
how it can be possible or how i can replace the underscore with the space and first character in a uppercase
Plz help me...
Thankx..
Regards
Bharat Bhushan
Useofasp.net/
Howtouseasp.net
salman beher...
All-Star
30571 Points
5848 Posts
Re: neeed a sql query
Dec 22, 2011 06:16 AM|LINK
Hi,
create a function for that and use like...
http://www.codeproject.com/KB/database/sqlserver.aspx
Thanks...
Sincerely,
Salman
iGulfam
Contributor
4794 Points
947 Posts
Re: neeed a sql query
Dec 22, 2011 06:19 AM|LINK
Use following Query
SELECT
REPLACE(UPPER(SUBSTRING(Topic_name, 1, 1))+LOWER(SUBSTRING(Topic_name, 2, LEN(Topic_name))), '_', ' ') AS topic
FROM tb_streak
My BLOG