Click here to Skip to main content
15,902,636 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to store mathematical symbole(like algebra ) in sql server 2008 ,asp.net , c# AND how to retrive record from database PLZ ANS ME
Posted
Comments
atulpatil6677@GMAIL.COM 24-Jul-13 5:52am    
NICE QUESTION !!!!!!!!!!!!!
[no name] 24-Jul-13 5:53am    
have you tried anything..??

1 solution

SQL Server supports Unicode characters in columns, and you can query using the N'...' prefix.

also check this

retrive-and-store-mathematical-question-in-sqlserver2005[^]

SQL
--------------------TABLE-------------------

create table MATH(id int,equation varchar(1000))
insert MATH
select 1,'POWER(x+1,2)' UNION ALL -- (x+1)^2
select 2,'COS(x)' -- Cosinus(x)

--------------------QUERY-------------------

declare @query nvarchar(1000)
declare @Result Float
declare @id int
declare @x float
set @x=0.5
set @id=1
set @query=(select equation from MATH where Id=1)
set @query='select ROUND('+replace(@query,'x',CAST(@x as varchar(50))+'000')+',5)'
exec(@query)
--RESULTS----------------------
--(0.5+1)^2=2.2500
-------------------------------
set @query=(select equation from MATH where Id=2)
set @query='select ROUND('+replace(@query,'x',CAST(@x as varchar(50))+'000')+',5)'
exec(@query)
--RESULTS----------------------
--cos(0.5)=0,87758
-------------------------------
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900