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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Superscript and Subscript in SQL Server

Author  Topic 

bridge
Yak Posting Veteran

93 Posts

Posted - 2005-11-11 : 01:50:24
How can we store the Superscript and Subscript in SQL Server i.e., 22 where second 2 is the power of first 2.

harshal_in
Aged Yak Warrior

633 Posts

Posted - 2005-11-11 : 01:57:45
To calculate 2 power of 2 u can use power() function...

He is a fool for five minutes who asks ,
but who does not ask remains a fool for life!

http://www.sqljunkies.com/weblog/sqldude
http://harshals.blogspot.com
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-11-11 : 02:09:41
Sounds like a presentation issue to me - or am I misunderstanding?

Kristen
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-11-11 : 02:18:24
You can make use of two columns one to store Superscript and other to store Subscript
Then write query

Select Power(Superscript ,Subscript) from yourTable

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

bridge
Yak Posting Veteran

93 Posts

Posted - 2005-11-15 : 04:43:24
Yes Kirsten, its presentation issue. I want to export the data to word format. It would be a question paper where 2 power 2 should be displayed. How can we store data in that presentation style?
Go to Top of Page

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2005-11-15 : 08:40:52
quote:
Originally posted by bridge
It would be a question paper where 2 power 2 should be displayed. How can we store data in that presentation style?



In the general case, store the text in a markup language such RTF, HTML or an XML format like DocBook or WordML.

If it's just a question of a superscript 1, 2 or 3, you can represent these in varchar (assuming you're using a collation that uses ISO Latin 1). They are characters 185, 178, 179 respectively. Note that, despite appearances, character 186 is not a superscript zero.

Unicode does have characters for the other superscript digits and subscript digits, and a few other characters. I don't know how word would cope with being fed these.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-11-15 : 11:46:38
"I want to export the data to word format"

Where does it originate? If it, for example, originates in Word then I suggest you store the data in a format that will allow you to store the raw data in the database, and then its just a question of "storing" and "retrieving" it - and there won't be any formatting etc. involved.

As Arnold said RTF etc. would be good. But you could just store a Word document (i.e. a MyStuff.DOC file) in SQL Server. In which case you will probably need to use an IMAGE datatype.

Kristen
Go to Top of Page
   

- Advertisement -