SQL batch intercept depending on the particular symbol string (case) function PARSENAME use and interception string

Internet problem:

 

 

Here is Insus.NET solution for reference purposes only.

CREATE TABLE #temp([Source] NVARCHAR(100))
INSERT INTO #temp([Source]) VALUES 
    ('2012-04-27 16:49:24$1$2'),
    ('2012-04-27 17:04:26$2$2'),
    ('2012-04-27 17:18:58$2$2926180')


SELECT [Source],
        PARSENAME(REPLACE([Source] , ' $ ' , ' . ' ), . 3 ) the AS  [ date ] ,
         PARSENAME ( the REPLACE ( [ the Source ] , ' $ ' , ' . ' ), 2 ) the AS  [ attendance number ] ,
         PARSENAME ( the REPLACE ( [ the Source ] , ' $ ' , ' . ' ),1 ) AS  [ Employee Number ] 
the FROM # the TEMP
Source Code

 

PARSENAME related function, this " function PARSENAME use and interception of the string " https://www.cnblogs.com/insus/p/10958452.html .

 

Guess you like

Origin www.cnblogs.com/insus/p/10959262.html