Home > database >  How custom SQL data displayed in its own way
How custom SQL data displayed in its own way

Time:11-08

1. SELECT
The substring (dbo. F_GetStr (FNAME, 1, ', '), charindex (' : ', dbo f_GetStr (FNAME, 1, ', ')) + 1, len (dbo. F_GetStr (FNAME, 1, ', ')) - charindex (' : 'dbo. F_GetStr (FNAME, 1,', ')) + 1) name,
The substring (dbo. F_GetStr (FNAME, 2 ', '), charindex (' : ', dbo f_GetStr (FNAME, 2 ', ')) + 1, len (dbo. F_GetStr (FNAME, 2 ', ')) - charindex (' : 'dbo. F_GetStr (FNAME, 2', ')) + 1) gender,
The substring (dbo. F_GetStr (FNAME, 3 ', '), charindex (' : ', dbo f_GetStr (FNAME, 3 ', ')) + 1, len (dbo. F_GetStr (FNAME, 3 ', ')) - charindex (' : 'dbo. F_GetStr (FNAME, 3', ')) + 1) known,
The substring (dbo. F_GetStr (FNAME, 4 ', '), charindex (' : ', dbo f_GetStr (FNAME, 4 ', ')) + 1, len (dbo. F_GetStr (FNAME, 4 ', ')) - charindex (' : 'dbo. F_GetStr (FNAME, 4', ')) + 1),
The substring (dbo. F_GetStr (FNAME, 5 ', '), charindex (' : ', dbo f_GetStr (FNAME, 5 ', ')) + 1, len (dbo. F_GetStr (FNAME, 5 ', ')) - charindex (' : 'dbo. F_GetStr (FNAME, 5', ')) + 1) English name
The FROM A_OOTEST
Display is





2. SELECT
CASE the WHEN FA LIKE '% name %' THEN the substring (FA, charindex (' : ', FA) + 1100)
The WHEN FB LIKE '% name %' THEN the substring (FB, charindex (' : ', FB) + 1100)
The WHEN FC LIKE '% name %' THEN the substring (FC, charindex (' : ', FC) + 1100)
The WHEN FD LIKE '% name %' THEN the substring (FD, charindex (' : ', FD) + 1100)
The WHEN FE LIKE '% name %' THEN the substring (FE, charindex (' : ', FE) + 1100) END AS a 'name',
CASE the WHEN FA LIKE '% % sex THEN substring (FA, charindex (' :', FA) + 1100)
The WHEN FB LIKE '% % sex THEN substring (FB, charindex (' :', FB) + 1100)
The WHEN FC LIKE '% % sex THEN substring (FC, charindex (' :', FC) + 1100)
The WHEN FD LIKE '% % sex THEN substring (FD, charindex (' :', FD) + 1100)
The WHEN FE LIKE '% % sex THEN substring (FE, charindex (' :', FE) + 1100) END AS 'gender'
Nicknamed the CASE WHEN FA LIKE '% %' THEN the substring (FA, charindex (' : ', FA) + 1100)
The WHEN FB LIKE '% % nicknamed the' THEN the substring (FB, charindex (' : ', FB) + 1100)
The WHEN FC LIKE '% % nicknamed the' THEN the substring (FC, charindex (' : ', FC) + 1100)
The WHEN FD LIKE '% % nicknamed the' THEN the substring (FD, charindex (' : ', FD) + 1100)
The WHEN FE LIKE '% % nicknamed the' THEN the substring (FE, charindex (' : ', FE) + 1100) END AS 'known',
CASE the WHEN FA LIKE '% % title THEN substring (FA, charindex (' :', FA) + 1100)
The WHEN FB LIKE '% % title THEN substring (FB, charindex (' :', FB) + 1100)
The WHEN FC LIKE '% % title THEN substring (FC, charindex (' :', FC) + 1100)
The WHEN FD LIKE '% % title THEN substring (FD, charindex (' :', FD) + 1100)
The WHEN FE LIKE '% % title THEN substring (FE, charindex (' :', FE) + 1100) END AS 'title',
CASE the WHEN FA LIKE '% name %' THEN the substring (FA, charindex (' : ', FA) + 1100)
The WHEN FB LIKE '% name %' THEN the substring (FB, charindex (' : ', FB) + 1100)
The WHEN FC LIKE '% name %' THEN the substring (FC, charindex (' : ', FC) + 1100)
The WHEN FD LIKE '% name %' THEN the substring (FD, charindex (' : ', FD) + 1100)
The WHEN FE LIKE '% name %' THEN the substring (FE, charindex (' : ', FE) + 1100) END AS 'English name'

The FROM (SELECT
Dbo. F_GetStr (FNAME, 1, ', ') FA,
Dbo. F_GetStr (FNAME, 2 ', ') FB,
Dbo. F_GetStr (FNAME, 3 ', '), FC,
Dbo. F_GetStr (FNAME, 4 ', ') FD,
Dbo. F_GetStr (FNAME, 5 ', ') FE

The FROM A_OOTEST) T


Are there any other methods that can be shown up

CodePudding user response:

This operation is very cost performance, it is recommended that each time you insert the data, the data directly to parse out, after the operation is simple,

CodePudding user response:

Specific how to do a great god can teach it

CodePudding user response:

Stunned, why so write, write SQL can run!!!!
  • Related