MS SQL Technical Interview Question & Answers

1.What is SQL Server ? Ans .Microsoft SQL Server is a relational database management system developed by Microsoft. As a database, it is...

1.What is SQL Server ?
Ans.Microsoft SQL Server is a relational database management system developed by Microsoft. As a database, it is a software product whose primary function is to store and retrieve data as requested by other software applications

2.what does Error severity 13 indicates
Ans.Transactional deadlock errors. 
This level of error severity indicates a transaction deadlock error.

3.Which TCP/IP port does SQL Server run on? How can it be changed?
Ans.SQL Server runs on port 1433. It can be changed from the Network Utility TCP/IP properties

4.What are the difference between clustered and a non-clustered index?
AnsA clustered index is a special type of index that reorders the way records in the table are physically stored. Therefore table can have only one clustered index. The leaf nodes of a clustered index contain the data pages.

A non clustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk. The leaf node of a non clustered index does not consist of the data pages. Instead, the leaf nodes contain index rows.

5.What are the different index configurations a table can have?
Ans.A table can have one of the following index configurations:
  •  No indexes
  • A clustered index
  • A clustered index and many nonclustered indexes
  • A nonclustered index
  • Many nonclustered indexes
6.What is OLTP (Online Transaction Processing)?
Ans.In OLTP - online transaction processing systems relational database design use the discipline of data modeling and generally follow the Codd rules of data normalization in order to ensure absolute data integrity. Using these rules complex information is broken down into its most simple structures (a table) where all of the individual atomic level elements relate to each other and satisfy the normalization rules.

7.What is the recommended way to send mail from SQLAgent in SQL Server 2005?
Ans.Database Mail 
You can use either Database Mail or SQLMail with SQL Agent in SQL Server 2005. However since SQLMail will be removed, it is recommended that you use Database Mail.

8.What's the difference between a primary key and a unique key?
Ans.Both primary key and unique key enforces uniqueness of the column on which they are defined. But by default primary key creates a clustered index on the column, where are unique creates a nonclustered index by default. Another major difference is that, primary key doesn't allow NULLs, but unique key allows one NULL only.

9.How does a differential backup know which extents have changed so that it can be very quickly run?
Ans.The DCM tracks changes. The differential backup reads the extents from this structure. 
A differential backup uses the Differential Change Map to determine which extents have changed and need to be include in the backup. This greatly speeds the differential backup process.

10.What does the Queue Reader Agent do in SQL Server 2005 replication?
Ans.This agent reads the subscriber logs and moves changes back to the publisher. 
This agent is used when the queued update model is chosen with transactional replication. It moves changes from the subscribers back to the publishers.

11.What is the Service Broker Identifier ?
Ans.A GUID that identifies the database on which Service Broker is running. 
Each database has a Service Broker identifier. This is a GUID in the service_broker_GUID column that identifies the databases on which Service Broker is running. It ensure that messages are delivered to the right database.

12.What does the max full-text crawl range option do? 
Ans.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

13.When is the use of UPDATE_STATISTICS command?
Ans.This command is basically used when a large processing of data has occurred. If a large amount of deletions any modification or Bulk Copy into the tables has occurred, it has to update the indexes to take these changes into account. UPDATE_STATISTICS updates the indexes on these tables accordingly

14.What is the difference between truncate and delete?
Ans.Truncate is a quick way to empty a table. It removes everything without logging each row. Truncate will fail if there are foreign key relationships on the table. Conversely, the delete command removes rows from a table, while logging each deletion and triggering any delete triggers that may be present.

15.What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?
Ans.They specify a search condition for a group or an aggregate. But the difference is that HAVING can be used only with the SELECT statement. HAVING is typically used in a GROUP BY clause. When GROUP BY is not used, HAVING behaves like a WHERE clause. Having Clause is basically used only with the GROUP BY function in a query whereas WHERE Clause is applied to each row before they are part of the GROUP BY function in a query.

16.What is SQL Server Agent?
Ans. SQL Server agent plays an important role in the day-to-day tasks of a database administrator (DBA). It is often overlooked as one of the main tools for SQL Server management. Its purpose is to ease the implementation of tasks for the DBA, with its full- function scheduling engine, which allows you to schedule your own jobs and scripts.

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

18.What is the easiest way to capture the SQL statement for a Report Builder report you're troubleshooting? 
Ans.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

19.What is Log Shipping?
Ans.Log shipping is the process of automating the backup of database and transaction log files on a production SQL server, and then restoring them onto a standby server. Enterprise Editions only supports log shipping. In log shipping the transactional log file from one server is automatically updated into the backup database on the other server

20.Name 3 ways to get an accurate count of the number of records in a table?
Ans.SELECT * FROM table1 
SELECT COUNT(*) FROM table1 
SELECT rows FROM sysindexes WHERE id = OBJECT_ID(table1) AND indid < 2

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

22.What are the three ways that Dynamic SQL can be issued?
Ans.
  • Writing a query with parameters.
  • Using EXEC.
  • Using sp_executesql
23.What is PRIMARY KEY?
Ans.A PRIMARY KEY constraint is a unique identifier for a row within a database table. Every table should have a primary key constraint to uniquely identify each row and only one primary key constraint can be created for each table. The primary key constraints are used to enforce entity integrity.

24.What is UNIQUE KEY constraint?
Ans.A UNIQUE constraint enforces the uniqueness of the values in a set of columns, so no duplicate values are entered. The unique key constraints are used to enforce entity integrity as the primary key constraints.

25.What is FOREIGN KEY?
Ans.A FOREIGN KEY constraint prevents any actions that would destroy links between tables with the corresponding data values. A foreign key in one table points to a primary key in another table. Foreign keys prevent actions that would leave rows with foreign key values when there are no primary keys with that value. The foreign key constraints are used to enforce referential integrity.

26.What algorithm is used to encrypt the Database Master Key when it is created?
Ans.Triple DES ,When you create a Database Master Key, it is encrypted using the password you supply with the Triple DES algorithm.

27.What does the CREATE SERVICE statement do in SQL Server 2005? 
Ans.This statement is used to setup new tasks for Service Broker queues. 
This statement is ue to create a new Service Broker service that is a set of tasks that are run on messages

28.Define candidate key, alternate key and composite key
Ans.A candidate key is one that can identify each row of a table uniquely. Generally a candidate key becomes the primary key of the table. If the table has more than one candidate key, one of them will become the primary key, and the rest are called alternate keys. A key formed by combining at least two or more columns is called composite key.

29.What is CHECK Constraint?
Ans.A CHECK constraint is used to limit the values that can be placed in a column. The check constraints are used to enforce domain integrity.

30.What are the authentication modes in SQL Server?
Ans.Windows mode and mixed mode (SQL & Windows).

31.Where do you think the users names and passwords will be stored in sql server?
Ans.They get stored in master db in the sysxlogins table. 

32.Which stored procedure will you be running to add a linked server?
Ans. sp_addlinkedserver, sp_addlinkedsrvlogin 

33.What is a Join in SQL Server?
Ans.Join actually puts data from two or more tables into a single result set. 

34.Can SQL Servers linked to other servers like Oracle?
Ans.SQL Server can be linked to any server provided it has OLE-DB provider from Microsoft to allow a link. 

35.Where are Notification Services event messages logged in SQL Server 2005? 
Ans.In the Windows Application Log ,Event messages are logged in the Windows Application log.

36.What is BCP? When does it used?
Ans. BulkCopy is a tool used to copy huge amount of data from tables and views. BCP does not copy the structures same as source to destination. BULK INSERT command helps to import a data file into a database table or view in a user-specified format

37.How many types of triggers are available and explain how you use after triggers ? 
Ans.Insert/Delete/Update

38.What's the maximum size of a row?
Ans.8060 bytes.

39.What is an index?
Ans.Indexes in SQL Server are similar to the indexes in books. They help SQL Server retrieve the data quicker.

40.What is database replicaion?
Ans.Replication is the process of copying/moving data between databases on the same or different servers.


Related

Interview Questions 6232501554177581853

Post a Comment

Follow Us

Hot in week

Recent

Comments

Side Ads

item