-4

Possible Duplicate:
How can I parse the first, middle and last name from a full name field in SQL?

Say I have some nvarchar data 'Joe Blogs'...

I need to be able to query the data to extract the first and last names.

firstname
----------
Joe

lastname
----------
Blogs

What is the simplest way of doing this?

4

1 回答 1

1

您需要创建一个 T-SQL 函数,该函数根据分隔符拆分字符串并返回标记(片段)。有一个可用的数字,例如这个:

T-SQL 拆分字符串

于 2012-12-03T16:01:42.120 回答