Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
bhaskarvarada
Starting Member
8 Posts |
Posted - 2010-04-05 : 07:57:32
|
| Hi All,I Want to store the super script and sub script data like H2O,H2SO4... in a table ... how can i achieve this |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-04-05 : 08:21:16
|
| superscript with what? can you elaborate?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
bhaskarvarada
Starting Member
8 Posts |
Posted - 2010-04-06 : 01:18:20
|
| Hi Visakh16,i need to store formulas in a column like (a+b)2 = a2+b2+2abHow can i achive this in Sql Thanks in advance |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-04-06 : 01:38:55
|
| store it as a varchar value------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2010-04-06 : 01:42:38
|
| Try like thisSelect '(a+b) '+char(178)+'= a '+char(178)+'+ b '+char(178)+'+ 2ab'Search about char() function!Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-04-06 : 02:19:14
|
How you store those formula depends on what do you need to do with the formula and how are you going to show those formula KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
byrdzeye
Starting Member
14 Posts |
Posted - 2010-04-06 : 09:57:23
|
| Good answer senthil_nagore.Another option is to store like:H<sub>2</sub>O(a+b)<sup>2</sup> = a<sup>2</sup>+b<sup>2</sup>+2aband have the display controlled by the presentation layer with an appropriate replace. So for html:select replace(replace('H<sub>2</sub>O','<sub>','<span class="sub">'),'</sub>','</span>') |
 |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-04-06 : 11:39:16
|
| it actually depends on how it's getting input. the *right* answer is visakh16's one. store it as a varchar()if you input subscript and superscript, it will be properly stored. if you're just putting a "2" in there it won't(a+b)² will be stored the way you want in the table. (a+b)2 won't so again, it comes down to how you're inputting the data |
 |
|
|
|
|
|