Home > database >  SQL Server will be the student's name is divided into two columns
SQL Server will be the student's name is divided into two columns

Time:09-29

And the name of three and four of the words of how to do

CodePudding user response:

Thinking: shan with compound surname first store to Excel, and then import the database matching,

CodePudding user response:

Three words is not necessarily a word surname, such as zhuge liang

Four word is not necessarily a compound surname, such as ginger Wang Jingmei

Have some words last name and compound surname first words have overlap, OuYangShuai, for example, is a European or surnamed ouyang

So, you this demand is difficult to realize

CodePudding user response:

refer to the second floor illiterate old gu response:
three words is not necessarily a word surname, such as zhuge liang

Four word is not necessarily a compound surname, such as ginger Wang Jingmei

Have some words last name and compound surname first words have overlap, OuYangShuai, for example, is a European or surnamed ouyang

So, you this demand is difficult to realize

Don't complicated, 7, 8 a name

CodePudding user response:

You put all your surname, alone on a table inside is right,

CodePudding user response:

Can use the exhaustive method to solve the problem is not a problem

CodePudding user response:

Should find rule first, and then you can open a dry! Do before, will be a column into 2 columns, please refer to the!

CodePudding user response:

refer to 6th floor qq_25073223 response:
should first find the rule, and then you can do it! Do before, will be a column into 2 columns, please refer to the!

This is just a job, a great god

CodePudding user response:

Now that is just a job, and when its name is regular, names are double word, name can be single to double, so less than 4 words for a surname, before 4 words takes two to name, is the application of case and the substring:
 SELECT CASE WHEN LEN (name) & lt;=3 THEN SUBSTRING (name, 1, 1) ELSE SUBSTRING (name, 1, 2) END surname, CASE WHEN LEN (name) & lt;=3 THEN SUBSTRING (name, 2, LEN (name) - 1) ELSE SUBSTRING (name, 3, LEN (name) - (2) the END of the FROM the Users 
  • Related