- World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions
Our Services
Get 9,000 Interview Questions & Answers in an eBook.

Get it now !!
Send your Resume to 6000 Companies
MS SQL Server Interview Questions & Answers - Learning Mode

MS SQL Server Interview Questions & Answers - Learning Mode

SQL Server is Microsoft's relational database management system (RDBMS). It is a full-featured databse primarily designed to compete against competitors Oracle Database (DB) and MySQL. Like all major RBDMS, SQL Server supports ANSI SQL, the standard SQL language. SQL Server offers the right editions to meet your needs, including Enterprise, Business Intelligence, Standard, Express, and Developer. SQL Server is a Microsoft product used to manage and store information. Technically, SQL Server is a ?relational database management system? (RDMS). Broken apart, this term means two things. First, that data stored inside SQL Server will be housed in a ?relational database?, and second, that SQL Server is an entire ?management system?, not just a database. SQL itself stands for Structured Query Language. This is the language used to manage and administer the database server.

Try MS SQL Server Interview Questions & Answers - Exam Mode

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 >> Next

Sort By : Latest First | Oldest First | By Rating

MS SQL Server Interview Questions & Answers - Learning Mode
Try MS SQL Server Interview Questions & Answers - Exam Mode
Question: How To Delete All Rows with TRUNCATE TABLE Statement in MS SQL Server?

Answer: If you want to delete all rows from a table, you have two options:

* Use the DELETE statement with no WHERE clause.
* Use the TRUNCATE TABLE statement.

The TRUNCATE statement is more efficient the DELETE statement. The tutorial exercise shows you a good example of TRUNCATE statement:

SELECT COUNT(*) FROM ggl_rates


SELECT COUNT(*) FROM ggl_rates
0 Source:
Question: How To Divide Query Output into Multiple Groups with the GROUP BY Clause in MS SQL Server?

Answer: Sometimes, you want to divide the query output into multiple groups, and apply group functions on each individual groups. Dividing query output into multiple groups can be done with the GROUP BY clause. Here is the syntax of a SELECT statement with a GROUP BY clause.

SELECT group_level_fields FROM source_tables
WHERE search_condition
GROUP BY group_by_expression

* group_by_express - An list of columns to be used as the group criteria - Rows that have the same combination of v Source:
Question: What is a database table?

Answer: A table in database is a data object used to store data. Tables have the following features:

* Data is stored in a table with a structure of rows and columns.
* Columns must be pre-defined with names, types and constrains.
* A table object may have other associated data objects like, constrains, triggers, indexes, and statistics.

For example, a table called Address may have columns defined to store different elements of an address like, street number, city, country, postal co Source:
Question: How to set the current database in MS SQL Server?

Answer: Once you are connected to the SQL Server, you should select a database to work with and set it as the current database using the "USE" statement with this syntax:

USE database_name

The following tutorial example shows you how to set "YourDataBaseName" as the current database, and create a table in "YourDataBaseName":

USE YourDataBaseName
Changed database context to 'YourDataBaseName'.


SELECT name, ty Source:
Question: Where are Notification Services event messages logged in SQL Server 2005?

Answer: In the Windows Application Log
Event messages are logged in the Windows Application log. Source:
Question: What Are Commonly Used ODBC Functions in PHP?

Answer: If you look at the PHP 5 manual, you will see a group of functions listed under the ODBC Functions (Unified) setion. The commonly used ODBC functions are:
* odbc_connect ? Establish an OBDC connection.
* odbc_data_source ? Returns information about a current connection.
* odbc_close ? Close an ODBC connection.
* odbc_exec ? Prepare and execute a SQL statement.
* odbc_fetch_row ? Fetch a row - moving the pointer to the a new row in a result object.
* odbc_result ? Get the value Source:
Question: What tool is available for ad hoc reporting by non IT end users in Reporting Services 2005?

Answer: Report Builder
Report Builder is bundled as part of Reporting Services 2005 and is targeted at end users needing to build ad hoc reports. BI Design Studio could be used, but typically requires more time and experience to use than the average end user will be willing to invest. Source:
Question: How To List All Tables in the Database using odbc_tables()?

Answer: If you want to get a list of all tables in the database, you can use the odbc_tables() function, which can actually be used to list all tables and views in the database. The syntax of odbc_tables() is:

$result_set = odbc_tables($connection_object,
$qualifier, # database name for SQL Server
$owner, # schema name for SQL Server
$name, # table or view name for SQL Server
$type # valid type names are TABLE and VIEW
#- The returning result set contains 5 fields:
#- TABLE Source:
Question: How can SQL Server Agent Mail send messages in SQL Server 2005?

Answer: SQL Mail through Extended MAPI or Database mail.
SQL Server Agent Mail can be configured to use Database Mail or Extended MAPI. Source:
Question: How To Create a Large Table with Random Data for Index Testing in MS SQL Server?

Answer: If you want to see how index can be used to improve data search performance, you have to build some large tables, which requires large amount of random data. This tutorial exercise helps you to build a large table with pure random data:

USE GlobalGuideLineDatabase;

-- Drop the old table, if needed
DROP TABLE ggl_random;

-- Create a table with primary key
CREATE TABLE ggl_random (
id INT,
rand_integer INT,
rand_number numeric(18,9),
rand_datetime Source:
Question: What Is SQL Language?

Answer: SQL, SEQUEL (Structured English Query Language), is a language for RDBMS (Relational Database Management Systems). During the 1970s, a group at IBM's San Jose research center developed a database system "System R" based upon Codd's model. Structured English Query Language ("SEQUEL") was designed to manipulate and retrieve data stored in System R. The acronym SEQUEL was later condensed to SQL. SQL was adopted as a standard by ANSI (American National Standards Institute) in 1986 and ISO (I Source:
Question: How To Use GO Command in "sqlcmd"?

Answer: "sqlcmd" is a command line client application to run Transact-SQL statements on a target SQL Server. When "sqlcmd" is started and connected to a SQL Server, it will start a new batch and prompt you to enter the first statement of the batch. You can enter one or more statements in one or more lines to form a Transact-SQL statement batch. To end a batch of statements and send it to the SQL Server for execution, you need to enter the GO command. The following "sqlcmd" tutorial session sends two bat Source:
Question: Why I am getting this error when renaming a database in MS SQL Server?

Answer: If you are trying to rename a database that is in use, you will get an error message like this: "The database could not be exclusively locked to perform the operation."

Before renaming a database, you must stop all client sessions using this database. Otherwise, you will get an error as shown in this tutorial example:

1. Launch one instance of SQL Server Management Studio and run:

USE GlobalGuideLine

2. Keep the first instance running and launch another instance Source:
Question: How To Declare and Use Cursor Variables?

Answer: There are two ways to representing a cursor:

1. A cursor name - A static name representing a cursor object. A cursor name should be linked to a cursor object in the DECLARE statement.

2. A cursor variable name - A variable name pointing to a cursor object. A cursor variable name should be declared with the CURSOR data type. It should be then assigned with a cursor object using the SET statement.

The tutorial exercise below shows you how to declare a cursor variable and assig Source:
Question: Can you call Notification Services APIs from unmanaged code?

Answer: 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. Source:
Question: How To List All Stored Procedures in the Current Database using MS SQL Server?

Answer: If you want to see a list of stored procedures in your current database, you can use the system view, sys.procedures as shown in this tutorial exercise:

USE GlobalGuideLineDatabase;

SELECT * FROM sys.procedures;

Name object_id schema_id type type_desc

---------- ----------- ----------- ---- --------------------

Hello 1621580815 1 P SQL_STORED_PROCEDURE

date 1653580929 1 P SQL_STORED_ Source:
Question: How To Create an Multi-Statement Table-Valued Function?

Answer: To create a multi-statement table-valued function, you need to define a temporary table as the returning table in the function. INSERT statements should be used to insert data into the returning table.

The tutorial exercise below shows you a simple example of how to build a temporary table and make it as the returning table of a function:

USE GlobalGuideLineDatabase;


@start_year INT, @end_year INT)

RETURNS @s Source:
Question: How To Change a Login Name in MS SQL Server?

Answer: If you want to change a login name, you can use the "ALTER LOGIN" statement as shown in this tutorial example:

-- Login with "sa"

-- Change login name
ALTER LOGIN ggl_Login WITH NAME = Dba_Login;

-- View login names
SELECT name, sid, type, type_desc FROM sys.server_principals
WHERE type = 'S';

name sid type type_desc

-------- ----------------------------------- ---- ---------

sa 0x Source:
Question: How To Loop through Result Set Objects using odbc_fetch_row()?

Answer: If the returning output of a query statement is captured in a result set object, you can use odbc_fetch_row() to loop through each row in the output.

The tutorial PHP script below shows you how to list tables in the database:

$con = odbc_connect('ggl_SQL_SERVER','sa','GlobalGuideLine');

$sql = "SELECT * FROM sys.objects"
. " WHERE type_desc='USER_TABLE'";
$res = odbc_exec($con, $sql);
print("User Tables:n");
while (odbc Source:
Question: What Are the Requirements on SQL Server Network Connections?

Answer: By default, SQL Server 2005 Express Edition is installed only one connection protocol enabled:

* Shared Memory - SQL Server connection protocol for applications that are running on the same machine where the SQL Server is running. For example, if you are running SQLCMD tool on the SQL Server machine, it will use the "Shared Memory" protocol.

If you want application that are running remotely to connect and access the SQL Server you need enable the "TCP/IP" protocol.

For appli Source:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 >> Next

India News Network
Latest 20 Questions
Payment of time- barred debt is: (a) Valid (b) Void (c) Illegal (d) Voidable
Consideration is defined in the Indian Contract Act,1872 in: (a) Section 2(f) (b) Section 2(e) (c) Section 2(g) (d) Section 2(d)
Which of the following is not an exception to the rule, "No consideration, No contract": (a) Natural love and affection (b) Compensation for involuntary services (c) Completed gift (d) Agency
Consideration must move at the desire of: (a) The promisor (b) The promisee (c) The promisor or any other party (d) Both the promisor and the promisee
An offer which is open for acceptance over a period of time is: (a) Cross Offer (b) Counter Offer (c) Standing Offer (d) Implied Offer
Specific offer can be communicated to__________ (a) All the parties of contract (b) General public in universe (c) Specific person (d) None of the above
_________ amounts to rejection of the original offer. (a) Cross offer (b) Special offer (c) Standing offer (d) Counter offer
A advertises to sell his old car by advertising in a newspaper. This offer is caleed: (a) General Offer (b) Special Offer (c) Continuing Offer (d) None of the above
In case a counter offer is made, the original offer stands: (a) Rejected (b) Accepted automatically (c) Accepted subject to certain modifications and variations (d) None of the above
In case of unenforceable contract having some technical defect, parties (a) Can sue upon it (b) Cannot sue upon it (c) Should consider it to be illegal (d) None of the above
If entire specified goods is perished before entering into contract of sale, the contract is (a) Valid (b) Void (c) Voidable (d) Cancelled
______________ contracts are also caled contracts with executed consideration. (a) Unilateral (b) Completed (c) Bilateral (d) Executory
A offers B to supply books @ Rs 100 each but B accepts the same with condition of 10% discount. This is a case of (a) Counter Offer (b) Cross Offer (c) Specific Offer (d) General Offer
_____________ is a game of chance. (a) Conditional Contract (b) Contingent Contract (c) Wagering Contract (d) Quasi Contract
There is no binding contract in case of _______ as one's offer cannot be constructed as acceptance (a) Cross Offer (b) Standing Offer (c) Counter Offer (d) Special Offer
An offer is made with an intention to have negotiation from other party. This type of offer is: (a) Invitation to offer (b) Valid offer (c) Voidable (d) None of the above
When an offer is made to the world at large, it is ____________ offer. (a) Counter (b) Special (c) General (d) None of the above
Implied contract even if not in writing or express words is perfectly _______________ if all the conditions are satisfied:- (a) Void (b) Voidable (c) Valid (d) Illegal
A specific offer can be accepted by ___________. (a) Any person (b) Any friend to offeror (c) The person to whom it is made (d) Any friend of offeree
An agreement toput a fire on a person's car is a ______: (a) Legal (b) Voidable (c) Valid (d) Illegal
Cache = 0.140625 Seconds