December 12, 2014 at 5:16 am
Hi ,
I have sample data like 'J.S.xxxx','J.xxxx.'
Want to separate the . in the middle of word with single space and display results in following way.
J. S. xxxx
J. xxxx
Need the code in optimized way.
Siva
December 12, 2014 at 5:25 am
You could just use a replace in your select
SELECT REPLACE(<columnName>, '.','. ')
FROM <tableName>
May not be efficient, but would work.
December 12, 2014 at 5:27 am
December 12, 2014 at 7:19 am
Maddave (12/12/2014)
You could just use a replace in your select
SELECT REPLACE(<columnName>, '.','. ')
FROM <tableName>
May not be efficient, but would work.
Actually if the data is consistent this is about the most efficient as you can do. It would run super fast even on millions of rows.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply