mardi 24 mars 2015

How to calculate the value in the row in SQL?

I what to add the value in row as i mentioned in the below code.


enter image description here


Here i have posted some sample code here.



Create Table #temp1
(
ID int,
Value Varchar(MAX)
)

Insert into #temp1 Values
(1,'0.1+0.26'),
(2,'1.1+7.25-4.65'),
(3,'2.1+6.24*3.3'),
(4,'3.14+5.23*2.2'),
(5,'0.143+4.22/3.4')

Select * from #temp1

Drop Table #temp1


Select 1 ID,0.1+0.26 [Value]
Union ALL
Select 2 ID,1.1+7.25-4.65 [Value]
Union ALL
Select 3 ID,2.1+6.24*3.3 [Value]
Union ALL
Select 4 ID,3.14+5.23*2.2 [Value]
Union ALL
Select 5 ID,0.143+4.22/3.4 [Value]


Can any one suggest me to solve this.


Aucun commentaire:

Enregistrer un commentaire