I have a unique issue. I've worked a long time with SQL Server. We import a file into SQL Server that includes Full Name. All I need to do is parse the full name into First and Last. If the name is English character set, my parse works fine. But, we're parsing Thai names which uses a different character set?
This is my code:
DECLARE @FullName NVARCHAR(MAX) = N'กล้วยไม้ สวามิวัศดุ์'
SELECT
LEN(@FullName) AS StringLength,
@FullName AS FullName,
REVERSE(@FullName) AS ReverseName,
LEFT(@FullName, LEN(@FullName) - CHARINDEX(' ', REVERSE(@FullName))) AS FirstName,
STUFF(RIGHT(@FullName, CHARINDEX(' ', REVERSE(@FullName))),1,1,'') AS LastName;
Results:
20 กล้วยไม้ สวามิวัศดุ์ ์ุดศัวิมาวส ้มไยว้ลก กล้วยไม้ สวามิวัศดุ์ NULL
Like I said, the query works fine when I use english. For example, 'John Smith' returns:
10 John Smith htimS nhoJ John Smith
I have searched this and other sites all day! Thanks in advance.