How to Transform String in SQL Server

How to Transform String in SQL Server

Say for example if you have column which is returning values such as 401*1 and you want to extract number from string




T-SQL Code:
 Select '401*1' AS ALTERNATE_ID, REVERSE(PARSENAME(REPLACE(REVERSE('401*1'), '*', '.'), 1)) As TransformedAlternateID


Comments

Popular posts from this blog

Calculating Age of the person in T-SQL

How to Troubleshoot Subscription issue in Reporting Services

MDX Queries - Current Day - Month and Year