Using LastIndexOf and SubString in mssql

How do I get [Result] column from [Code] column using ms sql

Id          Code
200001      43791
200001      67036
200006      19.09.01.08683      
200006      03.01.04.01.64230   
200007      19.01.03.02804    

Id          Result  Code
200001      43791   43791
200001      67036   67036
200006      08683   19.09.01.08683      
200006      64230   03.01.04.01.64230   
200007      02804   19.01.03.02804    

Answers


SELECT Id,
       RIGHT(Code, CHARINDEX('.', REVERSE('.' + Code)) - 1) AS [Result],
       Code
FROM   YourTable 

Need Your Help

Memory leak in Owin.AppBuilderExtensions

c# asp.net-identity owin

I use OWIN + Microsoft.AspNet.Identity.Owin (v.2.0.0.0) in Web application. I register UserManager/DbContext per web request, as widely recommended:

Workflow for statistical analysis and report writing

r statistics data-visualization

Does anyone have any wisdom on workflows for data analysis related to custom report writing? The use-case is basically this: