Dear helpful SQL experts,
I'm very new to SQL Server, but have to help my team with data cleansing on MS SQL Server 2000.
I've got a set of data that contains a field with Title, Name, Lastname all in one field (ex. Mr. John Smith). I have to split that field into 3 new fields (Title, FName, LName).
I can find the Title using left() like this:
update #Name set [Title]='Mr.' where left([Name],3)='Mr.'
But how would I handle Firstname and Lastname? There is always a space between First and Lastname, but there isn't always a space between Title and Firstname. I don't even know how to detect a space within a string in T-SQL.
Thank you very much in advance for any suggestion,
dragony
I'm very new to SQL Server, but have to help my team with data cleansing on MS SQL Server 2000.
I've got a set of data that contains a field with Title, Name, Lastname all in one field (ex. Mr. John Smith). I have to split that field into 3 new fields (Title, FName, LName).
I can find the Title using left() like this:
update #Name set [Title]='Mr.' where left([Name],3)='Mr.'
But how would I handle Firstname and Lastname? There is always a space between First and Lastname, but there isn't always a space between Title and Firstname. I don't even know how to detect a space within a string in T-SQL.
Thank you very much in advance for any suggestion,
dragony