Free Essay

Sql Ssrs Lab

In:

Submitted By Jiahomyee
Words 2275
Pages 10
SQL Server Reporting Services Lab 1

TASKS IN THIS LAB

To create a report server project 2 To create a new report definition file 2 To set up a connection 2 To define a Transact-SQL query for report data 3 To add a Table data region and fields to a report layout 4 Preview the report you have built to this point 5 Format the date field 6 Format the currency field 6 Format the header rows and table columns 7 Group data in a report 7 Add totals to the report 8 Add a grand total to the report 9

In this lab we create a basic table report based on the AdventureWorks2014 database. To create the report we use the Report designer tool with characteristics and functionality universal among products from multiple reporting applications vendors.

PART I - CREATING A REPORT PROJECT
Create your first report 1. Start SQL Server Data Tools.

2. On the File menu, point to New, and then click Project.

3. Select the Report Server Project.

4. For Name, type BasicReport. For location, you can leave in the default location or you can choose a location of your liking.

5. Click OK to create the project.
Create a new report definition file 1. In Solution Explorer, right-click Reports, point to Add, and click New Item. 2. In the Add New Item dialog box, click Report.

3. For Name, (at the bottom of the dialog box) type SalesOrders.rdl and then click Add. The Report Designer opens and displays the new .rdl file in Design view.

The Report Designer is a Reporting Services component that runs in SQL Server Data Tools (SSDT). It has two views: Design and Preview. You design the report in Design view and you see the data in Preview view.
PART II: SPECIFYING CONNECTION INFORMATION
Now we need to define a data source, which is connection information the report uses to access data from either a relational database, multidimensional database, or other resource.
To set up a connection 1. In the "Report Data" pane (to upper the left of your screen), click New and then click Data Source….. Or right click “Data Sources” and select “Add Data Source”

2. For Name, type AdventureWorksDW2014.

3. Make sure Embedded connection is selected and the Type is Microsoft SQL Server.

4. In Connection string, click Edit. In the dialog box that comes up:

In the Server name type or paste the name of your own database server. Or you can click the drop down menu for the available database servers to appear. You need to connect to the SQLSERVERLAB on your machine. The full name for my machine is DEMERP-XPS15\SQLSERVERLAB.

In the Log onto the server group, select Use SQL Server Authentication. Enter your sa userID and password.

In the Select or enter a database name list, select AdventureWorksDW2014 and then click OK.

5. Click OK. The data source AdventureWorksDW2014 is added to the Report Data pane.

PART III: DEFINING A DATASET FOR THE REPORT
After we define a data source, we need to define a dataset. A dataset is a collection of fields from the AdventureWorksDW2104 database. We can use the query designer to design the query. For this tutorial, we will use SQL to create a query that retrieves sales order information from the database.
To define a Transact-SQL query for report data 1. In the Report Data pane to the upper left part of your screen, click New, and then click Dataset…. The Dataset Properties dialog box opens.

2. In the Name box, type AdventureWorksDWDataset.

3. Click Use a dataset embedded in my report.

4. Make sure the name of your data source, AdventureWorksDW2014, is in the Data source text box, and that the Query type is Text.

5. Type, or copy and paste, the following Transact-SQL query into the Query box.
SELECT ProductKey, ModelName, ProductLine, Class, StandardCost, ListPrice, ReorderPoint
FROM dbo.DimProduct
WHERE (ListPrice IS NOT NULL) AND (Weight IS NOT NULL) 6. Click the Query Designer button. The query is displayed in the text-based query designer. You can toggle to the graphical query designer by clicking Edit As Text. View the results of the query by clicking the run (!) button on the query designer toolbar. You might need to enter your "sa" user id and password.
You see the data (273 records) from the DimProducts table.
Click OK to exit the query designer. 7. Click OK to exit the Dataset Properties dialog box.

PART IV: ADDING A TABLE TO THE REPORT
After the source fields have been defined, you can start designing the report. You create a report layout by dragging and dropping fields that you want to include in your report to the design surface.
Items that contain repeated rows of data from underlying datasets are called data regions. A basic report will have only one data region, but you can add more, for example, if you want to add a chart to your tabular report. After you add a data region, you can add fields to the data region.
Add a Table data region and fields to the report 1. Let us start adding controls to the report. Controls for the report can be tables, text boxes, images, charts, etc. To do this we need to drag and drop items from the toolbox. The Toolbox may appear as a tab on the left side of the Report Data pane. If the Toolbox is not visible, from the View menu, click Toolbox.

2. In the Toolbox, click Table, and then drag this table control on the design surface of the report. The Report Designer draws a table with three columns in the center of the design surface.

3. In the Report Data pane, expand (if it is not already expanded) the AdventureWorksDataset dataset to display the fields.

4. Drag the ProductKey field from the Report Data pane to the first column in the table. When you drop the field into the first column, two things happen. A data header for this field is created as well as a data control which will display the date data for each record in the report.

5. Drag the ModelName field from the Report Data pane to the second column in the table.

6. Drag the ProductLine field from the Report Data pane to the third column in the table.

7. Drag the Class field to the right edge of the third column until you get a vertical cursor and the mouse pointer has a plus sign [+]. When you release the mouse button, a fourth column is created.

8. Add all the rest of the fields this way. Your table should now look like the one in the following image:

9. Let us preview the data in the report to this point. Click the Preview tab. Report Designer runs the report and displays the data from the database. You will notice that the report is asking for a user id and password. Enter your sa user id and password and run the report. It should look like the following:

Embed security information in the data source
If you go back to design view and you try to run the report again, you will be asked for security information again. This is not practical at all since in practice we need to go multiple times between the design and preview screens so that we fine tune the report exactly the way we want. We can enter the security info directly in the data source so that we do not have to provide it every time. To do this: 1. In the "Report Data" pane to the left of your screen click on the "data sources" folder to expand it.

2. Right click on the "AdventureWorksDW2014" data source and the click on "Data Source Properties". A dialog box will come up.

3. In the upper left corner of the dialog box click on "credentials". Click on the radio button "Use this user name and password" and click OK.

4. Preview your report one more time. You see that it is not asking for credentials any more.

Working with calculated fields in the report 1. Now, we will add a calculated field in the report. In the "Report Data" pane to the left of your screen right click the "AdventureWorksDW2014" data set and then select "Add Calculated field". 2. In the dialog box that comes up enter e new field named "NominalProfit" at the bottom of the field rows as in the image below:

3. Then, click on the "fx" button for the NominalProfit field to enter the calculated field expression. A new dialog box will come up.

4. For expression, enter "=Fields!ListPrice.Value - Fields!StandardCost.Value" as in the image below and then click OK. A new field will now be available for our report.

5. In the "Report Data" pane to the left of your screen expand the dataset "AdventureWorksDW2014" and then drag the field "NominalProfit" at the end of the report. Your report should now look like the following:

Preview the report you have built to this point
Previewing a report enables you to view the rendered report without having to first publish it to a report server. You will probably want to preview your report frequently during design time. You might also notice that the report takes more time to load. This is because of the calculated field. Yu always have the option to create the field in the SQL statement on which the report is based and compare loading times.

On the File menu, click Save All to save the report.

PART V: FORMATTING A REPORT
Format the header rows and table columns
We will change the formatting of the header row to differentiate it from the rows of data in the report. 1. Select the whole row of the column headers and from the Format menu, point to Font and then click Bold. For font size select 12 points. 2. Now click on the cell of the intersection of the rows and columns of the report.

As soon as you do that a cross will appear. Put the mouse point on this cross and drag your report to the upper left part of the screen.

This is how your report design should look like:

3. Preview your report. It should look something like this:

4. On the File menu, click Save All to save the report. You can resize the width of the fields so that all data for each product shows in one row.

Format the NominalProfit field to display as currency
The NominalProfit field displays a general number. We will format it to display the number as currency. 1. In report design view, right-click the cell with the [NominalProfit] field expression and then click Text Box Properties.

2. Click Number, and in the Category field, select Currency.

3. Select Use 1000 separator (,).

4. Click OK.

5. Preview the report to see the change to the [NominalProfit] field and then change back to design view.

PART VI: ADDING GROUPING AND TOTALS
Group data in a report

Grouping and aggregating data are fundamental functionalities for any report design tool and as such they are incorporated in SSRS. Grouping records by a certain field allows us to display and summarize information with respect to the grouped field. Let us create a first group for our report. 1. Click the report Design tab if the report is not already in design view.

2. If you do not see the Row Groups pane at the bottom of the report, right-click the design surface and click view and then click Grouping.

3. From the Report Data pane, under the AdventureWorksDW2014 dataset, drag the ModelName field to the Row Groups pane. Place it above the row called (Details). The Row Groups window should look like this:

Preview your report. It should look similar to the following image.

You see that there are two Model Name fields. The first one is the group field and the second the table field where each model name is repeated for each record. Usually, we delete the second because it is redundant for the report since we already see the model name from the group field. * Delete the second model name field. Switch to Design view, right click on the second product line column and select “delete columns.” * Also increase the width of the model name group column so that model names in the report do not wrap. Your report should look now like the following:

Add totals to the report 1. Switch to Design view if you are not already there.

2. Right-click the field [Nominal Profit], and click Add Total. This sums up the total of all the nominal profit values for each group. Now, make this value bold and 11 points so that it can stand out in the report. Your report should look like the following:

3. You can add a background color to the totals row. While holding down the SHIFT key click the first and last cells of the nominal profit sum row (as shown in the image below). On the Format menu, click Background Color, select a green color and click OK.

4. Preview your report. It should look like the one in the following image.

Add grand totals to the report 1. Go back to the report design view. Right-click the Model Name cell, point to Add Total, and click After.

2. Preview your report and navigate to its last page. As you can see we now have grand totals for all the numeric fields. You can delete the ones that you do not need.

Similar Documents

Premium Essay

Exam

...Part 1: Question and Answer Question 1: Difference between Indexed Table and Indexed View.. Indexes on table are generally always used. You will have at least one unique index and one of the indexes will be clustered. Indexes on views are generally only applied as an optimization technique. Indexes on the view can improve performance using the views. Question 2: Clustered VS non-clustered index Question 3: Explain HIP table A: Heap table is a table that does not have any Clustered Index. Question 4: Maximum number of columns a table can have for SQL Server 2000, 2005, 2008 and 2012 A: 1024 Question 5: Difference between Delete and Truncate Delete and Truncate they both delete data. Difference is Delete keeps a record in the log file but truncate does not keep any record in the log file. So if you do a truncate operation you won't have any option to recover at a later time. Question 6: What is rollback? A: Rolls back an explicit or implicit transaction to the beginning of the transaction, or to a savepoint inside the transaction. You can use ROLLBACK TRANSACTION to erase all data modifications made from the start of the transaction or to a savepoint. It also frees resources held by the transaction. ROLLBACK { TRAN | TRANSACTION }      [ transaction_name | @tran_name_variable      | savepoint_name | @savepoint_variable ] [ ; ] Question 7: Difference between Primary Key and Unique Key Primary key does not allow...

Words: 1489 - Pages: 6

Premium Essay

Ethical Hacking

...Ethical Hacking 1 Running head: ETHICAL HACKING: Teaching Students to Hack Ethical Hacking: Teaching Students to Hack Regina D. Hartley East Carolina University Ethical Hacking 2 Abstract One of the fastest growing areas in network security, and certainly an area that generates much discussion, is that of ethical hacking. The purpose of this study is to examine the literature regarding how private sectors and educational institutions are addressing the growing demand for ethical hacking instruction. The study will also examine the opportunity for community colleges in providing this type of instruction. The discussion will conclude with a proposed model of ethical hacking instruction that will be used to teach a course in the summer semester of 2006 through the continuing education department at Caldwell Community College and Technical Institute within the North Carolina Community College System. Ethical Hacking 3 Ethical Hacking: Teaching Students to Hack The growing dependence and importance regarding information technology present within our society is increasingly demanding that professionals find more effective solutions relating to security concerns. Individuals with unethical behaviors are finding a variety of ways of conducting activities that cause businesses and consumers much grief and vast amounts annually in damages. As information security continues to be foremost on the minds of information technology professionals, improvements in this area are critically...

Words: 6103 - Pages: 25

Premium Essay

Computer Tricks

...EC-Council Press | The Experts: EC-Council EC-Council’s mission is to address the need for well educated and certified information security and e-business practitioners. EC-Council is a global, member based organization comprised of hundreds of industry and subject matter experts all working together to set the standards and raise the bar in Information Security certification and education. EC-Council certifications are viewed as the essential certifications needed where standard configuration and security policy courses fall short. Providing a true, hands-on, tactical approach to security, individuals armed with the knowledge disseminated by EC-Council programs are securing networks around the world and beating the hackers at their own game. The Solution: EC-Council Press The EC-Council | Press marks an innovation in academic text books and courses of study in information security, computer forensics, disaster recovery, and end-user security. By repurposing the essential content of EC-Council’s world class professional certification programs to fit academic programs, the EC-Council | Press was formed. With 8 Full Series, comprised of 27 different books, the EC-Council | Press is set to revolutionize global information security programs and ultimately create a new breed of practitioners capable of combating this growing epidemic of cybercrime and the rising threat of cyber war. This Certification: C|EH – Certified Ethical Hacker Certified Ethical Hacker is a certification...

Words: 61838 - Pages: 248

Premium Essay

Essentials of Systems Analysis and Design

...This page intentionally left blank Download at www.Pin5i.Com Essentials of Systems Analysis and Design Download at www.Pin5i.Com Editorial Director: Sally Yagan Editor in Chief: Eric Svendsen Executive Editor: Bob Horan Editorial Assistant: Ashlee Bradbury Director of Marketing: Patrice Lumumba Jones Executive Marketing Manager: Anne Fahlgren Senior Managing Editor: Judy Leale Production Project Manager: Kelly Warsak Senior Operations Supervisor: Arnold Vila Operations Specialist: Cathleen Petersen Creative Director: Blair Brown Senior Art Director/Design Supervisor: Janet Slowik Text Designer: Michael Fruhbeis Creative Director/Cover: Jayne Conte Cover Designer: Suzanne Duda Cover Art: Fotolia/3d mosaic/©Redshinestudio Manager, Rights and Permissions: Hessa Albader Media Project Manager: Lisa Rinaldi Media Editor: Denise Vaughn Full-Service Project Management: Tiffany Timmerman/S4Carlisle Publishing Services Composition: S4Carlisle Publishing Services Printer/Binder: Courier/Kendallville Cover Printer: Lehigh-Phoenix Color/Hagerstown Text Font: ITCCentury Book Credits and acknowledgments borrowed from other sources and reproduced, with permission, in this textbook appear on appropriate page within text. Microsoft® and Windows® are registered trademarks of the Microsoft Corporation in the U.S.A. and other countries. Screen shots and icons reprinted with permission from the Microsoft Corporation. This book is not sponsored or endorsed by or affiliated with the Microsoft...

Words: 179288 - Pages: 718

Free Essay

Core Concepts of Ais

...CORE CONCEPTS OF Accounting Information Systems Twelfth Edition Mark G. Simkin, Ph.D. Professor Department of Accounting and Information Systems University of Nevada Jacob M. Rose, Ph.D. Professor Department of Accounting and Finance University of New Hampshire Carolyn Strand Norman, Ph.D., CPA Professor Department of Accounting Virginia Commonwealth University JOHN WILEY & SONS, INC. VICE PRESIDENT & PUBLISHER SENIOR ACQUISITIONS EDITOR PROJECT EDITOR ASSOCIATE EDITOR SENIOR EDITORIAL ASSISTANT PRODUCTION MANAGER PRODUCTION EDITOR MARKETING MANAGER CREATIVE DIRECTOR SENIOR DESIGNER PRODUCTION MANAGEMENT SERVICES SENIOR ILLUSTRATION EDITOR PHOTO EDITOR MEDIA EDITOR COVER PHOTO George Hoffman Michael McDonald Brian Kamins Sarah Vernon Jacqueline Kepping Dorothy Sinclair Erin Bascom Karolina Zarychta Harry Nolan Wendy Lai Laserwords Maine Anna Melhorn Elle Wagner Greg Chaput Maciej Frolow/Brand X/Getty Images, Inc. This book was set in 10/12pt Garamond by Laserwords Private Limited, and printed and bound by RR Donnelley/Jefferson City. The cover was printed by RR Donnelley/Jefferson City. This book is printed on acid free paper. Founded in 1807, John Wiley & Sons, Inc. has been a valued source of knowledge and understanding for more than 200 years, helping people around the world meet their needs and fulfill their aspirations. Our company is built on a foundation of principles that include responsibility to the...

Words: 241803 - Pages: 968

Free Essay

There Once Was a Young Wild Pony

...a b c d e f g h i j k l m n o p q r s t u v w x y z aa ab ac ad ae af ag ah ai aj ak al am an ao ap aq ar as at au av aw ax ay az ba bb bc bd be bf bg bh bi bj bk bl bm bn bo bp bq br bs bt bu bv bw bx by bz ca cb cc cd ce cf cg ch ci cj ck cl cm cn co cp cq cr cs ct cu cv cw cx cy cz da db dc dd de df dg dh di dj dk dl dm dn do dp dq dr ds dt du dv dw dx dy dz ea eb ec ed ee ef eg eh ei ej ek el em en eo ep eq er es et eu ev ew ex ey ez fa fb fc fd fe ff fg fh fi fj fk fl fm fn fo fp fq fr fs ft fu fv fw fx fy fz ga gb gc gd ge gf gg gh gi gj gk gl gm gn go gp gq gr gs gt gu gv gw gx gy gz ha hb hc hd he hf hg hh hi hj hk hl hm hn ho hp hq hr hs ht hu hv hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq ir is it iu iv iw ix iy iz ja jb jc jd je jf jg jh ji jj jk jl jm jn jo jp jq jr js jt ju jv jw jx jy jz ka kb kc kd ke kf kg kh ki kj kk kl km kn ko kp kq kr ks kt ku kv kw kx ky kz la lb lc ld le lf lg lh li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me mf mg mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no np nq nr ns nt nu nv nw nx ny nz oa ob oc od oe of og oh oi oj ok ol om on oo op oq or os ot ou ov ow ox oy oz pa pb pc pd pe pf pg ph pi pj pk pl pm pn po pp pq pr ps pt pu pv pw px py pz qa qb qc qd qe qf qg qh qi qj qk ql qm qn qo qp qq qr qs qt qu qv qw qx qy qz ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz sa sb sc sd se sf sg sh si sj sk sl sm sn so...

Words: 29642 - Pages: 119

Premium Essay

Leadership Development - Doe

...Leadership Development Seminars and ECQ-based Readings The success or failure of any endeavor depends on leadership. Now, more than ever before, we need leaders in our organizations and in our world. Great leaders create and communicate a vision and move people into action to achieve it. They ignite our passion and inspire us to do our best. Government leaders in the 21st century are experiencing change at a more rapid pace than previous generations. Rapid advances in technology have expanded the quantity of work we are capable of accomplishing, and also where it’s accomplished. We have a more highly educated workforce, yet face diminishing resources with an increased demand for productivity, and the essential services we provide to the American public. To be successful at navigating these challenges leaders must develop the essential skills to motivate their employees, effectively communicate with others, fine-tune critical thinking skills, and build and leverage partnerships. Future leaders must also be visionary; i.e., possess the ability to identify trends and the courage to be innovative. Being technically adept in your field will no longer be enough. In response to these demands on senior executives, the U.S. Office of Personnel Management identified five Executive Core Qualifications (ECQs) that all aspiring government leaders and executives must possess. These ECQs and Fundamental Competencies were developed by OPM after extensive research on the attributes...

Words: 181771 - Pages: 728

Premium Essay

Career Planning

...Leadership Development Seminars and ECQ-based Readings The success or failure of any endeavor depends on leadership. Now, more than ever before, we need leaders in our organizations and in our world. Great leaders create and communicate a vision and move people into action to achieve it. They ignite our passion and inspire us to do our best. Government leaders in the 21st century are experiencing change at a more rapid pace than previous generations. Rapid advances in technology have expanded the quantity of work we are capable of accomplishing, and also where it’s accomplished. We have a more highly educated workforce, yet face diminishing resources with an increased demand for productivity, and the essential services we provide to the American public. To be successful at navigating these challenges leaders must develop the essential skills to motivate their employees, effectively communicate with others, fine-tune critical thinking skills, and build and leverage partnerships. Future leaders must also be visionary; i.e., possess the ability to identify trends and the courage to be innovative. Being technically adept in your field will no longer be enough. In response to these demands on senior executives, the U.S. Office of Personnel Management identified five Executive Core Qualifications (ECQs) that all aspiring government leaders and executives must possess. These ECQs and Fundamental Competencies were developed by OPM after extensive research on the attributes...

Words: 181771 - Pages: 728