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 |
cplusplus
Aged Yak Warrior
567 Posts |
Posted - 2015-01-19 : 12:43:04
|
I want to split columns value with space, most part of the data i do have doctorname with space and their title. some cases where just the name available with no title. in those cases want to show null value in their title column.Declare @Sample table (DrName_title varchar(100))insert @Sampleselect 'Perez-Pascual MD' union allselect 'Diaz-Monroig'Select firstPart(DrName_title) as Doctorname, secondpart(DrName_Title) as Doctor_title from @SampleThanks a lot for the helpful info. |
|
viggneshwar
Yak Posting Veteran
86 Posts |
Posted - 2015-01-21 : 02:32:34
|
select DrName_title, substring(DrName_title, nullif(CHARINDEX(' ', DrName_title),0), LEN(DrName_title))from @SampleRegardsViggneshwar A |
|
|
|
|
|