, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Answers to SQL Server (SQL,SSIS,SSRS,SSAS) Interview Questions – # 6

Question 1 : I have a sql table that I need to split into more 90 excel sheet based on a code. I could create an ssis package and use conditional split and create more than 90 excel sheet. But creating more than 90 excel sheet one at a time will be time consuming and if I have to use that package again for another table then I would have to make changes. Is there an easier/faster way to achieve split a table into more than 90 excel tabs? Is it possible to use foreachloop and dynamically split and create excel tab?

Answer :

1. Assuming that have some rules to split the data. Best way to save this information in a table.
2. Create a optimized stored procedure which will accept the input parameters (above) and return the data
2. Add a script task
2.1 Here connect to the DB
2.2 Create a for loop
2.2.1 Call the SP created in step 2 and get the data in the dataSet
2.2.2 Add a new worksheet to your workbook
2.2.3 Insert data to the new worksheet

Question 2 : What are Attunity Driver and why do we user in SSIS?

Answer :

Attunity provides 2 high speed connectors. One for Oracle and one for Teradata. They have been selected by Microsoft to be included with SQL Server 2008 Integration Services (SSIS) SQL 2008 Enterprise Edition. These drivers are highly optimized and very easy to use.

Optimized, best-in-class performance
The connectors deliver unparalleled throughput for extracting and loading data to and from Oracle and Teradata. Architected with Microsoft, the connectors use direct integration into internal SSIS buffering APIs, cutting through .NET and other layers, and also use the high speed load/extract utilities offered by Oracle and Teradata.

The connectors are fully integrated into the Business Intelligence Development Studio (BIDS), part of Microsoft Visual Studio 2008, offering a user experience similar to that of the SSIS generic OLEDB Connector, with intuitive capabilities including configuration, metadata browsing, and error routing.

Question 3 : How many type of protection level in SSIS package?

Answer :

It is a package level property. It is used to specify how sensitive information is saved inside the package. It also specify whether to encrypt the package or the sensitive portions of the package.

Each SSIS component designates that an attribute is sensitive by including Sensitive=”1″ in the package XML. When the package is saved, any property that is tagged with Sensitive=”1″ gets handled per the ProtectionLevel property setting in the SSIS package. The ProtectionLevel property can be selected from the following list of available options (click anywhere in the design area of the Control Flow tab in the SSIS designer to show the package properties):

  • DontSaveSensitive
  • EncryptSensitiveWithUserKey
  • EncryptSensitiveWithPassword
  • EncryptAllWithPassword
  • EncryptAllWithUserKey
  • ServerStorage

Question 4 : Difference between Cached Report and Snapshot Report?

Answer :

Cached Report

Here the system will save the last executed report. It is saved in the temp DB. It is not persisted. It has a lifetime e.g. 1 hour or so. We can have 1 only one “instance” per report (if you have parameters, you will have one per combination of parameter)

Snapshot Report

It is a persisted copy of the report. It is stored for good on the report database. You can have as many as you want. You can configure for example to save a snapshot of a report per day, so if you want to see how was your data 1 month ago, you just access the snapshot of that day.

When to use which one

Most of my reports, I cache them for 2 hours, so the first user who runs it will experience a small delay and the next will get the report on demand (with the data from when the report was ran, of course)

For large reports, execute them at night and configure them to be run from a snapshot (option “Render this report from a report execution snapshot”).

Question 5 : What are check point and how they work?

Answer :

SSIS 2005 included a feature called checkpoints, which allows you to restart the package if it fails for any reason. During package execution, the last successfully completed task or container is noted in a checkpoint file, and the checkpoint file is removed if the package completes successfully. But if the package fails before completing, the checkpoint file remains available as a reference to the location from which to restart the package.

You need to set three package properties:

CheckpointFileName. For this property, you need to provide a path and filename for the checkpoint file. If you plan to keep checkpoints implemented when you put a package into production, it’s a good idea to use a Universal Naming Convention (UNC) path.

CheckpointUsage. This property has three possible values: Never, Always, and IfExists. The default is Never, which prevents checkpoint creation. When you specify the Always option, the package uses the checkpoint file if it exists. If it doesn’t exist, the package fails. Therefore, the Always option isn’t recommended for a package in production because the package shouldn’t be failing regularly. (A package failure is the only way a checkpoint file gets created. Once the package completes successfully, the checkpoint file is removed.) The best option to use is IfExists. When you select this option, the package uses the checkpoint file if it exists. If it doesn’t exist, the program starts from the beginning of the package.

SaveCheckpoints. This property must be set to True. Otherwise, the previous settings won’t have any effect. By default, it’s set to False.

For details please refer – http://sqlmag.com/sql-server-2008/use-checkpoints-restart-failed-ssis-packages

Question 6 : How check point works in for loop?

Answer :

The Foreach Loop container is another atomic unit of work that can be restarted. However, the checkpoint file does not contain information about the work completed by the child containers, and the Foreach Loop container and its child containers run again when the package restarts.

Question 7 : Can we apply style sheet in SSRS and how?

Answer :

There are two ways to apply style sheet in SSRS
1. Hard Code in RDL File
2. Dynamically – You can save your style in DB and pull that in a DataSet and then apply.

For details please refer – http://www.keepitsimpleandfast.com/2011/11/how-to-implement-style-sheets-in-your.html

Question 8 : How to show “No Data Found” Message to end user?

Answer :

Add a text box. Set expression of the text box = IIF(Count(,”DataSet1″)=0,”No Data Found”, Nothing)
and set the visibility of this text box = IIF(Count(,”DataSet1″)=0,False,True)

Question 9 : Sometime we need to debug out SSIS Package but we do not want to insert records in destination but still we want to use all the transformations and dump these all records in some dummy destination. The goal can be to check the extraction performance from source OR view data at different points of Package but we do not want to insert data in destination at all.

Answer :

In this kind of scenario you can use below solutions-

1. Multicast transformation
2. Row Count Transformation

Question 10 : Can we debug SSIS package. If Yes, How?

Answer :

You can debug a Package by Setting Breakpoints on a Task or a Container

To set breakpoints in a package, a task, or a container follow below-

  • In SQL Server Data Tools (SSDT), open the Integration Services project that contains the package you want.
  • Double-click the package in which you want to set breakpoints.
    In SSIS Designer, do the following:
  • To set breakpoints in the package object, click the Control Flow tab, place the cursor anywhere on the background of the design surface, right-click, and then click Edit Breakpoints.
  • To set breakpoints in a package control flow, click the Control Flow tab, right-click a task, a For Loop container, a Foreach Loop container, or a Sequence container, and then click Edit Breakpoints.
  • To set breakpoints in an event handler, click the Event Handler tab, right-click a task, a For Loop container, a Foreach Loop container, or a Sequence container, and then click Edit Breakpoints.
  • In the Set Breakpoints dialog box, select the breakpoints to enable.
    Optionally, modify the hit count type and the hit count number for each breakpoint.
  • To save the package, click Save Selected Items on the File menu.

Question 11 : How to create Temporary Table using SSIS?

Answer :

You can use Execute SQL task to create temp table and set the property RetainSameConnection on the Connection Manager to True so that temporary table created in one Control Flow task can be retained in another task.

Question 12 : We get the files in our Source Folder all day long. Each file is appended copy of previous file. We want to create a SSIS Package that will load only the most recent file to our table.?

Answer :

Its simple create 2 variables, folderpath and filename. Now in script task, create a loop and find out the latest file. Now you can read the latest file in the script task itself and insert the data into the table.

for details please refer – http://www.techbrothersit.com/2013/12/ssis-how-to-get-most-recent-file-from.html

Question 13 : What are Lazy aggregations?

Answer :

Processing mode property of a partition/measure group determines how partitions will be available to users. Processing mode has two possible options – Regular and Lazy Aggregations.

Regular – Default. When set to regular, partitions will be available to users after data has been loaded and aggregations are created completely.

Lazy Aggregations – When set to lazy aggregations, partitions will be available to user queries immediately after data has been loaded. Aggregations will be created as a separate background process while users start to query the partition.

Process Full will internally executes Process Data and Process Index before the partition can be used for queries. If processing mode is set to Lazy Aggregations, partition will be released for user queries after Process Data is completed. Process Index will be executed in the background. As aggregations don’t exist while users begin to query the partition they may experience slow performance.

Question 14 : How we can ignore failure and continue loop?

Answer :

The Propagate variable in SSIS is used to determine whether an event is propagated to a higher level event handler. This allows package execution to continue once an event is handled in the container that has generated an Error.



Question 15 : What are Partition processing options?

Answer :

When you process objects in Microsoft SQL Server Analysis Services, you can select a processing option to control the type of processing that occurs for each object. Processing types differ from one object to another, and by changes that have occurred to the object since it was last processed. If you enable Analysis Services to automatically select a processing method, it will use the method that returns the object to a fully processed state in the least time.Processing settings let you control the objects that are processed, and the methods that are used to process those objects.

Mode Applies to Description
Process Default Cubes, databases, dimensions, measure groups, mining models, mining structures, and partitions. Detects the process state of database objects, and performs processing necessary to deliver unprocessed or partially processed objects to a fully processed state. If you change a data binding, Process Default will do a Process Full on the affected object.
Process Full Cubes, databases, dimensions, measure groups, mining models, mining structures, and partitions. Processes an Analysis Services object and all the objects that it contains. When Process Full is executed against an object that has already been processed, Analysis Services drops all data in the object, and then processes the object. This kind of processing is required when a structural change has been made to an object, for example, when an attribute hierarchy is added, deleted, or renamed.
Process Clear Cubes, databases, dimensions, measure groups, mining models, mining structures, and partitions. Drops the data in the object specified and any lower-level constituent objects. After the data is dropped, it is not reloaded.
Process Data Dimensions, cubes, measure groups, and partitions. Processes data only without building aggregations or indexes. If there is data is in the partitions, it will be dropped before re-populating the partition with source data.
Process Add Dimensions, measure groups, and partitions. Process Add is not available for dimension processing in Management Studio, but you can write XMLA script performs this action. For dimensions, adds new members and updates dimension attribute captions and descriptions.
Process Update Dimensions Forces a re-read of data and an update of dimension attributes. Flexible aggregations and indexes on related partitions will be dropped.
Process Index Cubes, dimensions, measure groups, and partitions Creates or rebuilds indexes and aggregations for all processed partitions. For unprocessed objects, this option generates an error. Processing with this option is needed if you turn off Lazy Processing.
Process Structure Cubes and mining structures If the cube is unprocessed, Analysis Services will process, if it is necessary, all the cube’s dimensions. After that, Analysis Services will create only cube definitions. If this option is applied to a mining structure, it populates the mining structure with source data. The difference between this option and the Process Full option is that this option does not iterate the processing down to the mining models themselves.
Process Clear Structure Mining structures Removes all training data from a mining structure.

For details please refer – https://msdn.microsoft.com/en-us/library/ms174774.aspx

Question 16 : How to make connection with SFTP server?

Answer :

SFTP stands for Secure File Transfer Protocol which is a world wide accepted secure protocol to transfer and access files over a secure channel. The data and channel are encrypted in SFTP mode, which prevents unauthorized access by any intruders and it’s mainly used between companies to transfer secure and sensitive information.

You may be aware of the FTP task in SSIS which allows us to copy or paste files to/from a FTP site, but unfortunately SSIS doesn’t support communication over SFTP. A work around for this will be to use PSFTP through an Execute Process Task in SSIS to download the file to our local machine. PSFTP is a SFTP client tool provided by PuTTy (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) to transfer files between computer systems using the SFTP protocol.

A solution for this scenario will include the following steps:

Download PSFTP.exe file to our destination folder
Create a batch file with logic to download the text file using Windows command language
Create a SSIS package with an Execute Process Task to run PSFTP.exe

For details please refer – https://www.mssqltips.com/sqlservertip/3435/using-sftp-with-sql-server-integration-services/

Question 17 : Difference between NONEMPTY vs NON EMPTY IN MDX?

Answer : Please refer follow link


Question 18 : Difference between Report Server and Report Manager:?

Answer :

The report server is the central component of a Reporting Services installation. It consists of a pair of core processors plus a collection of special-purpose extensions that handle authentication, data processing, rendering, and delivery operations. Processors are the hub of the report server.

Report Manager: Report Manager is a web based tool built using ASP.NET application to view/access SSRS reports. It is not available in SharePoint mode.