when (CHARINDEX('₹', @promo_text) > 0 and ISNUMERIC(SUBSTRING(@promo_text, (CHARINDEX('₹', @promo_text)+1),3))=1) then try_cast(try_convert(money,(substring(@promo_text,(charindex('₹', @promo_text)+1),3))) as decimal)
DECLARE @v NVARCHAR(30) = N'₹1234 discount'; select @v AS InitialValue; select CAST( SUBSTRING(@v, CHARINDEX(N'₹', @v) +1, CHARINDEX(' ', @v) - CHARINDEX(N'₹', @v) ) AS DECIMAL(8,0)) AS Rupees;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)