Click here to Skip to main content
15,940,550 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
am designing a project for online test series for all subject like mathematics, physics, chemistry, . I have a problem in storing mathematical equation which includes special symbols an in organic chemistry structural formulas etc.How can we store it in sql server 2014 database
Wendelius 17-Jan-15 13:40pm    
Do you mean you need to store the equation as text in the database but the text must support special characters?
Tomas Takac 17-Jan-15 13:41pm    
Serialize it to XML and store that in database.
iamvinod34 17-Jan-15 13:45pm    

Storing and retrieving such data is one thing, presenting it is an other. If you want to present such tests in a browser, you need a format that is easy to render. You might think of storing those formulas/equations/etc... in image format. Works great, but it is quite complicated to keep the images associated with the rest of the content in a relational database.
If you don't want to edit them semantically, you can simply store the whole test as XHTLM (nvarchar(max) in the SQL Server database table). Why, because you have inline SVG[^], which is perfect for such things. You can simply author images with tools like InkScape, CorelDraw, or dedicated editors if you like, paste into the html code, and store the test with all that it needs. Still, inline SVG is not cross-browser (see table on the link above). If you need you can also use inline image (using data UI scheme[^]) in some cases (or both) - this is also not complerely supported by all browsers.
So your test will be self-contained in a single field of a single table row - if you can afford the supprt limitations of these methods.
Share this answer
Wendelius 17-Jan-15 14:11pm    
Nice suggestion.
SQL Server supports Unicode characters (see[^]) so if you can express the formula in a way where those characters are sufficient, you can store the formula simply in a nvarchar[^] field
Share this answer
RedDk 17-Jan-15 13:54pm    

But I imagine his problem is more along the lines of "how do I input characters that aren't found on my system" ...
Wendelius 17-Jan-15 13:58pm    
Could be...

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