Wednesday, April 30, 2008

Microsoft SQL Server Interview Questions And Answers (SET -2)

Microsoft SQL Server Interview Questions And Answers (SET -2)

How are modified extents tracked in SQL Server 2005 (which internal structures)?
Differential Change Map and Bulk Change Map
There are two internal structures that track extents modified by bulk copy operations or that have changed since the last full backup. They are the Differential Changed Map (DCM) and the Bulk Changed Map (BCM).

What does this return?
select (1324 & 1024)

This performs a bitwise AND operation between the two integers and sets the result to this. Since 1024 is a single set bit in it's value, if the corresponding bit is set to 1, then in the result the bit is set to 1. In this case, since no other bits would generate two 1s, the result is equivalevt to the mask, or 1024.

What does the Log Reader agent in SQL Server 2005 replication do?
This agent reads the publisher log for transactions to send to the distributor.
This agent is tasked with reading the transaction log in transactional replication and moving those transactions that need to be replicated to the distributor.

You are performing an update of your Scalable Shared Database and receive note that two reports run at the same time received different results. These reports were both run during your update. What type of update did you perform?
A rolling update
When performing a rolling update, doing the detach and attach on each server as opposed to detaching from all then attaching to all, it is possible that different reporting servers will display different results.

What does a @@fetch_status of -2 mean in SQL Server 2005?
The row being fetched is missing.
This means that the row that was being fetched from the cursor is missing.

You want to be sure that your Scalable Shared Database is as available as possible. Which of the following is not needed for this?
Use Database Mirroring to fail over between the old reporting database and the new one.
The update process for a Scalable Shared database with minimal downtime involves putting out a new copy of the database, detaching the old database from each server, and then attaching the new database to each server.

What is the cost threshhold for parallelism in SQL Server 2005?
This is the number of seconds that a serialplan cannot exceed if it is to be used. A parallel plan is used if the estimate exceeds this value.
This is the threshold at which SQL Server determines whether a serial or parallel plan is to be used. When SQL Server calculates that a serial plan exceeds the threshold, it will elect to use a parallel plan instead.

You have a Scalable Shared Database setup for reporting purposes on SQL2. You want to be able to keep a point in time view of the reporting database each month. What can you do?
Make a new copy of the production database each month and then copy that to the SAN. Attach it as a new Scalable Shared Database each month to the reporting servers.
A Scalable Shared Database does not support database snapshots, so you would have to manually create a new database each month with the data view you need and add this as a new Scalable Shared Database to the SAN and each reporting server.

You have an old database that needs to run in compatibility mode 65 on your SQL Server 2005 server. Which framework would you use to manage this database programmatically?
SMO does not support compatibility modes 60 or 65, so you would need to use DMO instead.

You have two Service Broker instances running. One is on SQL1 with the default collation and the other is on SQL2 setup for French collation. Which collation is used for Service Broker messages sent between the instances?
Service Broker does not consider the collation, using byte-by-byte matching for names.
Neither collation is used. Service Broker operates in a collation independent method that removes collation information from the messages.

What does the max full-text crawl range option do?
Determines the number of partitions used in an index crawl.
This option helps optimize the full-text indexing process by specifying the number of partitions the SQL Server uses during index crawls.

Which of the following is not an allocation unit in SQL Server 2005?
The three types of allocation units are: IN_ROW_DATA, LOB_DATA, and ROW_OVERFLOW_DATA. Each heap or index has IN_ROW_DATA which holds part of the data. LOB_DATA is used for large object data types and ROW_OVERFLOW_DATA is used for varible length data that causes a row to exceed the 8060 byte limit.

Which of the following is the best use for a Scalable Shared Database in SQL Server 2005?
A reporting database server
A scalable shared database is a feature that allows you to setup read-only database on a separate server for reporting purposes. This database provides an identicle view of your data from another server.

You are loading 100 rows of data into a narrow table that is heavily used by your production inventory queries. It was recommended that you drop the indexes on the table before the load and then rebuild them after the load is complete. Is this something you would do?
This does not make sense.
For such a small number of rows, it is unlikely that dropping the indexes will improve the performance of your load. If this were 100,000 rows, then it might make sense.

How can SQL Server Agent Mail send messages in SQL Server 2005?
SQL Mail through Extended MAPI or Database mail.
SQL Server Agent Mail can be configured to use Database Mail or Extended MAPI.

What is the scale of measurement for the cost threshold for parallelism setting in SQL Server 2005?
This value measures the number of seconds for a plan where the optimizer chooses between serial and parallel plans.

Which of the following statements best describes the filter capabilities of Report Builder?
Users can do equals, greater than, less than, etc, plus they can do logical AND, OR, NOT operations. Users can also group filters to allow more advanced filters.
While it looks a little different than you may be used to, the filter builder is reasonably rich, allowing most standard evaluation types and rich boolean comparisons. The only weak spot in the set is no support for LIKE, you have to make do with CONTAINS.

True or false, Report Builder supports user defined run time parameters?
Absolutely true. Users can define any portion of a filter to be a run time prompt, letting other users easily change the filter as needed. Not only is it easy to set up, Report Builder automatically populates a list of all possible choices based on the column being filtered.

Using Report Builder that is bundled with Reporting Services 2005, which of the following would work as a way to add a derived field to a report?
Add a field to the model in Report Builder using the built in formula/function support
While Report Builder cannot be used to build or maintain models, it does allow you to add a virtual field that exists only within that report - to the end user it looks like the model is being modified.

If you absolutely need a report to look the same regardless of what OS or viewing software is being used, which of the following file formats would be the best choice?
TIFF is the correct answer. By rendering as an image there are no concerns about different fonts, problems with page breaks, etc. PDF's are almost as good and more commonly used of course, with the advantage that document maps are translated to bookmarks that are usable - something not possible with a raw image.

True or false, Report Builder offers direct export to a Microsoft Access database as one of its supported export options?
False. Supported formats include Excel, CSV, XML, TIFF, MHTML, and PDF. XML or CSV could be easily imported into Access, but there is way to add the data directly from Report Builder

When discussing image support in Report Builder, which of the following is the most accurate statement?
Users can add one or more images, but they will appear in the header or footer of the report, they cannot be added to the detail row. Images that are stored as row data in the database can be rendered at the detail level.
Multiple images can be added, but they appear in the header or footer depending on where placed on the report. The only way to get an image at the detail level (row based) is to have it be part of the database and included in the model.

Using Report Builder, which of the following is the best statement about the formatting options for Boolean columns?
Booleans are formatted as True/False and there are no other built in options, but you could build an expression using IIF that would let you do other formatting
From the format dialog there are no extra formatting options for Booleans, Report Builder renders them as True/False. Writing an expression that you add to the model view is the easiest way to work around this limitation.

What is the easiest way to capture the SQL statement for a Report Builder report you're troubleshooting?
Run Profiler
Profiler will work as long as you have permissions to profile the server and is the the best solution because it requires no change to the Report Server itself. There is a way to log all report SQL to a log file, but that option was not listed here and is better used if you want to do analysis rather than troubleshooting.

Clicking File, Save in Report Builder does which of the following?
Saves the report to the report server
File|Save writes the report to the Report Server. Users have the option to also save the report to disk by using File|Save to File. Report Builder users cannot modify the model.

Which of the following choices show the three report formats supported by Report Builder ?
Table, Matrix, Chart
Report Builder can build a report formatted as a table, chart, or matrix (cross tab), but only ONE can be used in any given report.

Using Report Builder, which of the following statements is correct about formatting numbers?
Users can pick from a small number of predefined formats and they have the option to specify a custom format
There are give built in formats; general, currency, percentage, two place decimal, and exponent. Users can also define a custom format using a .Net format string.

True or false, Report Builder supports using the LIKE function inside filters?
There is no LIKE support, the next best thing is the CONTAINS function which works as if you specified both a leading and trailing wild card.

Which RAID levels store parity information?
Only RAID 5 (of those listed) contains parity information.