Microsoft SQL Server
Interview Questions And Answers (SET -5)
What would happen when you execute the code below in Query Analyzer (SQL Server 2000)
CREATE PROCEDURE sp_who
Information about current SQL Server users and processes is displayed.
The explanation could be found in the Books Online under Creating a Stored Procedure. One of the sections, named System Stored Procedures which describes how SQL Server looks up the system stored procedure has this note: Important If any user-created stored procedure has the same name as a system stored procedure, the user-created stored procedure will never be executed.
How is Thesaurus data configured in SQL Server 2005 Full-Text Search?
An XML file in the file system named tsxxx.xml where xxx is a code.
The thesaurus file for SQL Server 2005 is an XML file containing data and stored in SQL_Server_install_pathMicrosoft SQL ServerMSSQL.1MSSQLFTDATA directory. There is one for each language and it is named tsxxx_.xml, where xxx is the three letter language code.
What does a report model provide in SQL Server 2005 Reporting Services?
A report model provides familiar business names for database tables and fields
A Report model provides business names and terms for database fields and tables. It allows for predefined relationships between tables as well as grouping items together logically.
What can tracer tokens measure in SQL Server 2005 transactional replication?
1 and 3
Tracer tokens measure two things. One is the amount of time elapsed between a command being committed on the publisher and being written to the distribution database. The other is from the writing to the distribution database and being committed to a subscriber. This allows you to determine the latencies for transactions moving through your replication topology.
You want to script the execution of an Integration Services package from the command line for use from a Unix scheduler. What utility would you use?
The dtexec.exe utility is used to configure and execute Integration Services packages from the command line.
What does the sqlwb utility do?
Opens SQL Server 2005 Management Studio.
sqlwb.exe actually opens Management Studio and can be configured to optionally open a solution, project, or script file when it starts.
You want to automate the installation of SQL Server 2005 using SMO for your custom application and ensure that the encryption features are available with a service master key. What method would you call to create this key?
The Regenerate method under the ServiceMasterKey object.
To create a Service Master Key in SMO, you would get a handle to the ServiceMasterKey object under the Server object and then call the Regenerate method.
How can you determine which Service Broker ports are being used on your server?
Query the system catalog view: sys.conversation_endpoints
The system catalog view sys.conversation_endpoints will show you which Service Broker endpoints, and therefore ports, are open on your server.
In Full-Text Search, what is word breaking?
Determining word boundaries.
Word breaking involves finding the boundaries of a word. This is different for different languages and SQL Server 2005 includes word breakers for 23 languages.
Can you call Notification Services APIs from unmanaged code?
Yes, but only for simple subscriptions.
Notification Services can be called from unmanaged code through a COM interface for simple subscriptions only. Condition based subscriptions are not supported through COM Interop.
Which of the following is true about the Raw File Source in SQL Server 2005 Integration Services?
It does not support an error output.
The raw file source has only one output and does not support an error output. It also reads faster than other data sources because it has no parsing or translation and does not use a connection manager.
You wish to configure event logging for your SQL Server 2005 Notification Services instance. Where would you make this change?
Edit the nsservice.exe.config file in the C:Program FilesMicrosoft SQL Server90NotificationServices
Event logging and most Notification Services configuration require editing an XML file. In this case, the NSservice.exe.config file is edited to set the appropriate editing level.
Which of the following is not true about the Raw File Destintion connection in SQL Server 2005 Integration Services?
It supports BLOB object data.
The Raw File Destination connection does not use a connection manager, supports NULL data, and only has one input. It also does not support BLOB data or have an error output.
What message types exist in SQL Server 2005 Service Broker?
These are defined for each contract.
Each application that sets up queues and contracts inside Service Broker must define the message types that are valid for the contract.
What does the CEILING() function do?
Returns the smallest integer greater than or equal to the value passed in.
CEILING() returns the smallest integer that is great than or equal to the value passed in.
What is a dialog conversation in the SQL Server 2005 Service Broker.
A dialog conversation is a conversation between services.
A dialog conversation is a conversation between services. A conversation includes messages being passed back and forth as part of a contract.
What is row versioning in SQL Server 2005?
Row versioning keeps a copy of each row for use by applications or transactions to prevent readers from being blocked by writers.
Row versioning is a method whereby the database engine keeps a copy of a row's data as it existed before the start of a transaction for queries to read this data and reduce locking contention if they are configured.
What does @@MAX_PRECISION return?
The maximum precision for numeric and decimal data.
This function returns the maximum precision for numeric and decimal data as set on the server. The default for SQL Server 2005 is 38.
Which of the following columns can be indexed with SQL Server 2005 Full-Text Search?
char, varchar, nvarchar, and varbinary, text, ntext, and image
All character columns, char, varchar and nvarchar columns including max, text and ntext, and image columns are valid for full-text searching.
When starting SQL Server 2005 from the command line, what does the -h switch do?
This switch reserves memory space for Hot-Add memory metadata, available with AWE enabled.
This switch is used with 32-bit SQL Server and AWE to reserve memory to reserve memory space for Hot-Add memory metadata.
Janice has two tables, Employees and Orders. She has been asked to provide a report of the number of orders processed by each employee in the month of June. If an employee didn?t process any orders, the report should reflect the employee?s name and a zero for the number of orders. Which of the queries is the best one for Janice to use to return the information she has been requested to provide?
E.LastName + ', ' + E.FirstName AS [Employee Name]
, ISNULL(O.[# of Orders], 0) [# of Orders]
FROM dbo.Employees E
LEFT JOIN (SELECT
, COUNT(*) [# of Orders]
WHERE OrderDate >= '20060601'
AND OrderDate < '20060701'
GROUP BY EmployeeID) O
ON E.EmployeeID = O.EmployeeID
ORDER BY [Employee Name]
While it would seem BETWEEN would save Janice a bit of typing, there is a problem with it. BETWEEN corresponds, based on these queries to the same as:
WHERE OrderDate >= ?20060601? AND OrderDat e<= ?20060701?
It?s the latter one that causes the query to be incorrect as it would potentially include orders placed on July 1st at midnight (20060701 corresponds to July 1, 2006 at 00:00:00). While this would be unlikely in a small retail environment, it is entirely possible in larger operations, especially those which are international in scope. Therefore, the use of BETWEEN in this case is not appropriate.
With respect to the GROUP BY, it must appear in the subquery on the Orders table, as given in the answer. When it occurs after the LEFT JOIN, the rows where there is an employee but no order for the month will be lost. Since Janice must report on employees who had no sales, this is unacceptable.