Add two types of casting to one column

I have a column called salary in my table. Another value table is stored as

  • 5 lakhs 12 thousand similarly ..

I want to get the result

  • 10000 * 5 + 12 * 1000

I created one request,

SELECT TOP(10) 'INSERT INTO jobs(Budget) VALUES('+ CAST(SUBSTRING( CAST(r.Budget AS VARCHAR(50)), 0, PATINDEX('%laks%', r.Budget))*100000 AS VARCHAR(50)) + ',' +CAST(SUBSTRING( CAST(r.Budget AS VARCHAR(50)), PATINDEX('%laks%', r.Budget) + 4 ,patindex('%Thousands%', r.Budget) - PATINDEX('%laks%', r.Budget) - 4)* 1000 AS VARCHAR(50))+')' FROM requirementsdetailsfororganization r 

Here I can separate the individual values. I can not add two values.

when i use the above query my result

 INSERT INTO jobs(Budget) VALUES(200000,5000) 

Expected Result:

 INSERT INTO jobs(Budget) VALUES(205000) 
+4
source share
1 answer
 SELECT TOP(10) 'INSERT INTO jobs(Budget) VALUES('+ CAST(SUBSTRING(CAST(r.Budget AS VARCHAR(50)), 0, PATINDEX('%laks%', r.Budget))*100000 + SUBSTRING(CAST(r.Budget AS VARCHAR(50)), PATINDEX('%laks%', r.Budget) + 4, patindex('%Thousands%', r.Budget) - PATINDEX('%laks%', r.Budget) - 4)* 1000 AS VARCHAR(50))+')' FROM requirementsdetailsfororganization r 
+5
source

All Articles