Headder AdSence

SSRS Reports – Displaying Superscripts and Subscripts

SSRS Reports – Displaying Superscripts and Subscripts


S Superscripts and Subscripts
At some point in time you may find that you need to display numbers in superscript or subscript format in a SSRS report. I ran into it recently in a report that required footnotes describing the contents of columns. If you ever need to display chemical or mathematical formulas you may also find number subscripting and superscripting necessary. Dig into the font properties available in SSRS, and you will not find these options available.

Using Unicode Fonts to Display Superscripts and Subscripts

The good news is, there is another method available that will allow you to display numbers in the superscript or subscript styles in a SSRS report. Unicode fonts include special characters that display as superscripted and subscripted versions of the normal number characters. The following table lists the integer code points that represent the Superscript and Subscript versions of the number characters. We will be able to display these characters directly or by using the character codes in an expression in SSRS.
NOTE: It’s a good idea to have an idea of your target audience if you’re thinking about using this Unicode fonts method for displaying superscripts and subscripts. For your typical business user working on a desktop or laptop, they should not encounter any problems. If you expect to have users viewing your SSRS reports using mobile devices or computers running antiquated operating systems or web browsers, you may run into situations where some of these Unicode characters may not be display properly.
NumberSuperscriptSubscriptSuper. CodeSuper. UsageSub. codeSub. Usage
08304ChrW(8304)8320ChrW(8320)
1¹185ChrW(185 )8321ChrW(8321)
2²178ChrW(178 )8322ChrW(8322)
3³179ChrW(179 )8323ChrW(8323)
48308ChrW(8308)8324ChrW(8324)
58309ChrW(8309)8325ChrW(8325)
68310ChrW(8310)8326ChrW(8326)
78311ChrW(8311)8327ChrW(8327)
88312ChrW(8312)8328ChrW(8328)
98313ChrW(8313)8329ChrW(8329)
So let’s see how it works. Let’s pretend as an example that you have a column of a tablix in your report and you want to display the following text in that column’s header:
"CO₂ Levels"

Choosing a Unicode Font

SSRS Superscripts and Subscripts Select Unicode FontFirst, be sure to choose a Unicode font to use for your header text that includes these special Superscript and Subscript characters. I’ve seen it recommended to use Lucida Sans Unicode elsewhere. I do like the look of the Superscript and Subscript characters in that font, but I found in some testing in my environment that the number 4 was not being displayed properly in Internet Explorer browsers. I chose instead to use the fontArial Unicode MS and that cleared up the IE issue for me.

Methods For Using Unicode Fonts To Display Superscripts and Subscripts

The first method you can use to include these characters is just to copy and paste them where you need them as plain text. Keep a link to this article handy, and any time you need to use the characters grab what you need from the above table. Assuming you’ve selected a compatible font, you should not have any problems seeing your superscripts and subscripts both while you’re designing your SSRS report and when you’ve deployed it.
Using our “CO₂ Levels” example, try copying and pasting the example text directly into the column header in your report that you’ve already set up with a good Unicode font. See how the subscripted 2 appears just as it should? Now try directly copying a superscript character from the table above and using it instead. It’s that easy!
Another option for displaying these superscript and subscript characters is to use the Visual Basic ChrW() function in an expression. The ChrW() function will display characters based on the Unicode code point integer we give it. For example, we could create this placeholder expression for “CO₂ Levels” by using theSub. Code for 2 from the table above:
="CO" & ChrW(8322) & " Levels"
But what if you are using a font in your SSRS report that doesn’t support these Superscript and Subscript characters? Say your report uses Times New Roman, and you want to keep using that font. Easy, leave everything set up as it is in Times New Roman, and where you need to use a special character create aseparate placeholder expression just for it. In this case, your example may now look like this:
CO<<expr>> Levels
Then, in the placeholder’s properties, make sure you choose an appropriate Unicode font that includes the superscript and subscript characters. Now in your placeholder you can paste in the appropriate character you need or set up an expression similar to this:
="" & ChrW(8322)
There are many other Unicode characters, of course, that you may want to display in your SSRS reports beyond the number set listed in the table above. You can find available characters in the Windows Character Map application or from a website like Unicode Map. These sources include the hexadecimal code point for the characters as well. To use that info in the ChrW() function you’d have to convert the hexadecimal number to a binary number, which can be done online with a tool like Math is Fun’s converter. From the Character Map image example below, subscript 2 is 2082 in hex, which if you do the math you’ll find is 8322 in decimal.
Subscript Character Map example
Here are a few other Unicode characters you may find handy to include in reports:
⁰ ¹ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ⁺ ⁻ ⁼ ⁽ ⁾ 
₀ ₁ ₂ ₃ ₄ ₅ ₆ ₇ ₈ ₉ ₊ ₋ ₌ ₍ ₎
ᵃ ᵇ ᶜ ᵈ ᵉ ᶠ ᵍ ʰ ⁱ ʲ ᵏ ˡ ᵐ ⁿ ᵒ ᵖ ʳ ˢ ᵗ ᵘ ᵛ ʷ ˣ ʸ ᶻ
ᴬ ᴮ ᴰ ᴱ ᴳ ᴴ ᴵ ᴶ ᴷ ᴸ ᴹ ᴺ ᴼ ᴾ ᴿ ᵀ ᵁ ᵂ
ₐ ₑ ᵢ ₒ ᵣ ᵤ ᵥ ₓ
½ ¼ ¾ ⅓ ⅔ ⅕ ⅖ ⅗ ⅘ ⅙ ⅚ ⅛ ⅜ ⅝ ⅞ № ℠ ™ © ®

Conclusion

Now you know of a couple of ways to use Unicode characters to include superscripts and subscripts in your SSRS reports.  Hopefully you’ll find these methods useful, and as always, feel free to share your thoughts or how this article helped you.

How to Create Database in SQL Server

You can create database by SQL Server Management Studio (SSMS) or by T-SQL both methods are quite simple and takes very less time to create. But before creating any database you must analyse your business requirements, database parameters, available resources and no. of users and your working environments. To create a database you need at least one primary data file and one log file.
Now we will see how to create database.

Create Database by T-SQL

Syntax:
CREATE DATABASE <DatabaseName>
Database name is defined as nvarchar(128) with data type as ‘sysname’, you can simply create database with default values in a single line as:
CREATE DATABASE BooksInfo
It will create the database with default path and values but if you want to create as per your requirements then you can create the same as given below. Here each file has it’s logical and physical file name.
CREATE DATABASE BooksInfo
ON PRIMARY
(
 NAME = BooksInfo_Primary, 
 FILENAME = 'C:\Database\BooksInfo.mdf',
 SIZE = 50MB,
 MAXSIZE = 500MB,
 FILEGROWTH = 10%
)

LOG ON
(
 NAME = BooksInfo_Log,
 FILENAME = 'C:\DatabaseLog\BooksInfo_log.ldf',
 SIZE = 10MB,
 MAXSIZE = UNLIMITED, 
 FILEGROWTH = 10MB
)
It will create primary data file as BooksInfo.mdf and log file as BooksInfo_log.ldf but if you want to include one file group also then you can create the database as given below.
CREATE DATABASE BooksInfo
ON PRIMARY
(
 NAME = BooksInfo_Primary, 
 FILENAME = 'C:\Database\BooksInfo.mdf',
 SIZE = 50MB,
 MAXSIZE = 500MB,
 FILEGROWTH = 10%
),

FILEGROUP BooksInfo_G1
( 
 NAME = BooksFileGroup1,
 FILENAME = 'C:\Database\BooksInfo_G1.ndf',
 SIZE = 50MB,
 MAXSIZE = 500MB,
 FILEGROWTH = 10% )

LOG ON
(
 NAME = BooksInfo_Log,
 FILENAME = 'C:\DatabaseLog\BooksInfo_log.ldf',
 SIZE = 10MB,
 MAXSIZE = UNLIMITED, 
 FILEGROWTH = 10MB
)
Now your database will be created with one file group also as BooksInfo_G1.ndf. You can also mention collation with create database command but if you have not specified it then it will consider collation of your SQL Server instance as default.

Create Database by SSMS

To create database with SQL Server Management Studio go to Object Explorer –> right click on  Databases –> select New Database –> enter a database name and click OK.
It will create a database with default values and path. If you want you can change the path and default values in new database window and add filegroup as well, by default primary filegroup is set.

Permissions required to Create Database

You need following permissions to create a database.
– CREATE DATABASE,
– CREATE ANY DATABASE
– ALTER ANY DATABASE

SQL - STR() Function

SQL - STR() Function

OneDrive Pin Setting In Lumia Microsoft

SQL Server useful tips, tricks and shortcuts


SQL Server useful tips, tricks and shortcuts

SQL Server useful tips, tricks and shortcuts

For Below Headings we will display you some SQL Server useful tips,tricks and Shortcuts.

1. Display Line Numbers in SQL Editor
2. Comment SQL Code Shortcut
3. Uncomment SQL Code
4. SQL Code into Upper Case
5. SQL code into Lower Case
6. Add/View/Delete Bookmark in SQL


Display Line Numbers in SQL Editor


While working with large SQL Code it’s better to display line Numbers so that if in case you will get any error you can find the exact line Number.


1.       Open SSMS
2.       Click Tools-Options
3.       Expand Text Editor
4.       Click on Transact-SQL
5.       Check Box-Line Numbers
6.       Ok –As in Below Screenshots.


    Comment SQL Code Shortcut

    There are two ways to comment your SQL code.
    1.       Using  tool bar
    2.     Select your code
    3.     Click on icon as in screenshot.


    2nd Method to comment SQLcode    
    1.       Select your code
    2.       Press CTRL+K,CTRL+C
             This will comment your entire Selected Code.


    Uncomment SQL Code Shortcut


    There are two ways to uncomment your SQL code.
    1.   Using  tool bar
    2.   Select your code
    3. Click on icon as in screenshot.

    2nd Method to Uncomment SQL code
    1.    Select your code
    2.      Press CTRL+K,CTRL+U
          This will comment your entire Selected Code.

    SQL Code into Upper Case


    In order to follow proper SQL coding Standards, sometimes you need to change your code into Upper case.
    1.   Select your SQL code that you want to change into Upper Case
    2.    Press CTRL+SHIFT+U
       All Selected Code will get Converted into Upper case

    SQL Code into Lower Case


     In order to follow proper SQL coding Standards, sometimes you need to change your code into Lower case.
    1.       Select your SQL code that you want to change into Lower Case
    2.       Press CTRL+SHIFT+L
            All Selected Code will get Converted into Lower Case

     

    Add/View/Delete Bookmark


    Sometimes while working with SQL Code you want to bookmark a Specific text .Wherever you will have that specific text in the code it will add a bookmark to that line as below screenshot.

    Add Bookmark


    1.       Press CTRL+F
    2.      Click –Bookmark ALL

    To view Bookmark Window


    1.        Press CTRL+K, CTRL+W
    2.     2nd way Go to View Menu-Click on Bookmark Window.

    To Delete Bookmark Window


    1.        Press CTRL+K, CTRL+L
    2.      From Bookmark window delete all bookmarks as below.