Tags

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


Answers to SQL Server Interview Questions – # 5

Answers to given below for SQL Server Interview Questions – # 5. Please note that these are two the point answers, If you want any answer in detail please let me know.

1. Can we put table data and Clustered index on different file groups?

No its not possible. If a table has a clustered index, moving the clustered index to a new filegroup moves the table to that filegroup. Also note that you cannot move indexes created using a UNIQUE or PRIMARY KEY constraint using Management Studio. To move these indexes use the CREATE INDEX statement with the (DROP_EXISTING=ON) option in Transact-SQL.You require ALTER permission on the table or view. User must be a member of the sysadmin fixed server role or the db_ddladmin and db_owner fixed database roles.

2. Can we put table data and Non Clustered index on different file groups?

Yes its possible. It is usually done to get better performance.By default, indexes are stored in the same filegroup as the base table on which the index is created. By creating the nonclustered index on a different filegroup, you can achieve performance gains if the filegroups are using different physical drives with their own controllers. Data and index information can then be read in parallel by the multiple disk heads. For example, if Table_A on filegroup f1 and Index_A on filegroup f2 are both being used by the same query, performance gains can be achieved because both filegroups are being fully used without contention. However, if Table_A is scanned by the query but Index_A is not referenced, only filegroup f1 is used. This creates no performance gain. Because you cannot predict what type of access will occur and when it will occur, it could be a better decision to spread your tables and indexes across all filegroups. This would guarantee that all disks are being accessed because all data and indexes are spread evenly across all disks, regardless of which way the data is accessed. This is also a simpler approach for system administrators.

3. How many key columns you can put in a clustered index?

We can have 16 columns as key column in clustered index. It’s really that the KEY of an index can be 900 bytes OR 16 columns – whichever comes first. But, even that’s not always true. If a table has an XML column then the PK can have a maximum of 15 columns.

4. What are role playing Dimensions in analysis services?

Dimensions can be used for different purposes within the same database. One of the very common example is “Date” dimension.
We can have “Order Date” and “Order Processing Date” and “Order Delivery Date”. This is often referred to as a “role-playing dimension”. In simple words you can say that same dimension can be used for different purposes in the cube then it is called role playing dimension.

5. What are blocking and unblocking transformations? Provide me a some examples of blocking & unblocking transformations in SSIS.

Data flow transformations in SSIS use memory/buffers in different ways. The way transformation uses memory can impact the performance of your package. Transformations memory/Buffer usage are classified into 3 categories:

1.Non Blocking 2.Semi Blocking 3. Full Blocking

For details and list of blocking and non blocking transformations click here –
http://sqlchampion.com/2015/02/12/ssis-non-blocking-partially-blocking-and-full-blocking/

6. What are the ways to deploy a SSIS package?

To deploy SQL Server Integration Services packages, you use the Package Installation Wizard. By using this wizard, you can deploy packages to one of two locations:

  • To an instance of SQL Server.
  • To the file system.

To deploy packages to an instance of SQL Server

  • Open the deployment folder on the target computer.Double-click the manifest file, .SSISDeploymentManifest, to start the Package Installation Wizard. 
  • On the Deploy SSIS Packages page, select the SQL Server deployment option.
  • Optionally, select Validate packages after installation to validate packages after they are installed on the target server.
  • On the Specify Target SQL Server page, specify the instance of SQL Server to install the packages to and select an authentication mode. If you select SQL Server Authentication, you must provide a user name and a password.
  • On the Select Installation Folder page, specify the folder in the file system for the package dependencies that will be installed.
    If the package includes configurations, you can edit configurations by updating values in the Value list on the Configure Packages page. 
  • If you elected to validate packages after installation, view the validation results of the deployed packages.

To deploy packages to the file system

  • Open the deployment folder on the target computer. 
  • Double-click the manifest file, .SSISDeploymentManifest, to start the Package Installation Wizard.
  • On the Deploy SSIS Packages page, select the File system deployment option.
  • Optionally, select Validate packages after installation to validate the packages after they are installed on the target server.
  • On the Select Installation Folder page, specify the folder in which to install packages and package dependencies.
  • If the package includes configurations, you can edit updatable configurations by updating values in the Value list on the Configure Packages page.
  • If you elected to validate packages after installation, view the validation results of the deployed packages.

https://technet.microsoft.com/en-us/library/ms140117%28v=sql.105%29.aspx?f=255&MSPPError=-2147217396

7. Let’s say you have two data flows in control flow and based on some condition you want to call one data flow and based on the another you want to call another one? How can you do this?

Use Precedence constraints

Precedence constraints link executables, containers, and tasks in packages in a control flow, and specify conditions that determine whether executables run. An executable can be a For Loop, Foreach Loop, or Sequence container; a task; or an event handler. Event handlers also use precedence constraints to link their executables into a control flow.

A precedence constraint links two executables: the precedence executable and the constrained executable. The precedence executable runs before the constrained executable, and the execution result of the precedence executable may determine whether the constrained executable runs or not.

For details please visit-

https://msdn.microsoft.com/en-us/library/ms141261.aspx

8. Can you remove one of the export options that we have in SSRS for a particular user?

Export ( Rendering Extensions ) options are controlled from a configuration file called rsreportserver.config. The RSReportServer.config is located in the following folders, depending on the report server mode:

Native mode report server:
C:\Program Files\Microsoft SQL Server\MSRS12.MSSQLSERVER\Reporting Services\ReportServer

SharePoint mode report server:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\WebServices\Reporting

Directly it is not possible. You have to write custom code to achieve this. Javascript could a good solution for it. You can capture the user details at page load and based on that you can remove particular rendering option.

9. Assume you have two data sets and you want to map these two data sets to a single tablix in a SSRS report? Is it possible? If yes, how?

Use lookup. Use Lookup to retrieve the value from the specified dataset for a name/value pair where there is a 1-to-1 relationship. To retrieve multiple values for a single name or key field where there is a 1-to-many relationship, use LookupSet Function. To call Lookup for a set of values, use Multilookup Function.

10. Let’s say you have folder and inside that you have some excel files, Now you to insert these excel files into respective database tables. Now the headers of each excel is not at the top(First row), it is placed at some random location like 5th row, 10th row etc. Design a SSIS package for this.

Ya, It’s very weird kind of requirement where you need build a logic and the requirement is not fixed. In this case you can use a script task and inside that you can handle the random header issue using the .net code. Please let me know if any better way to achieve this.

Cheers, Thanks for reading !

-Pawan Khowal

MSBISkills.com

Advertisements