CoolInterview.com - 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
COOLINTERVIEW.COM DATABASE INTERVIEW QUESTIONS MS SQL SERVER INTERVIEW QUESTIONS 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: 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: CoolInterview.com
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
GO
Changed database context to 'YourDataBaseName'.

CREATE TABLE Links (Name NVARCHAR(32))
GO

SELECT name, ty Source: CoolInterview.com
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: CoolInterview.com
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: CoolInterview.com
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: CoolInterview.com
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;
GO

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

name sid type type_desc

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

sa 0x Source: CoolInterview.com
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: CoolInterview.com
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
GO
5

TRUNCATE TABLE ggl_rates
GO

SELECT COUNT(*) FROM ggl_rates
GO
0 Source: CoolInterview.com
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: CoolInterview.com
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;
GO

SELECT * FROM sys.procedures;
GO

Name object_id schema_id type type_desc

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

Hello 1621580815 1 P SQL_STORED_PROCEDURE

date 1653580929 1 P SQL_STORED_ Source: CoolInterview.com
Question: How To Replace Given Values with NULL using NULLIF()?

Answer: Sometime you want to hide certain values by replacing them with NULL values. SQL Server offers you a nice function called NULLIF() to do this:

NULLIF(expression, value)
-- Returns NULL if "expression" equals to value"
-- Returns "expression", otherwise

NULLIF() can be viewed as the reverse function of ISNULL(). The tutorial script below shows you a good example of using NULLIF():

USE GlobalGuideLineDatabase;
GO

SELECT id, counts FROM ggl_links;
GO

i Source: CoolInterview.com
Question: How To Execute the Cursor Queries with "OPEN" Statements?

Answer: Once a cursor is declared, you need to execute the query attached to the cursor so that the result set returned from the query can be accessed through the cursor. To execute the cursor query, you should use the OPEN statement as in this format:

OPEN cursor_name;

When you are done with using the result set attached to a cursor, you should close the result set to free up server resources.

The tutorial example below shows you how to open and close a cursor:

USE GlobalGui Source: CoolInterview.com
Question: How To How To Convert Numeric Expression Data Types using the CONVERT() Function??

Answer: If you want to convert the data type of a numeric expression to a new data type, you can use the CONVERT(data_type, expression) function. The tutorial exercise below shows you how to use the CONVERT() function:

-- FLOAT converted to NUMERIC by CONVERT()
DECLARE @pi FLOAT(24);
SET @pi = 3.141592E+00;
SELECT CONVERT(NUMERIC(5,2), @pi);
GO
3.14

-- FLOAT converted to NUMERIC by CONVERT()
DECLARE @x FLOAT(24);
SET @x = 12345.12E+00;
SELECT CONVERT(NUMERIC(10,5), Source: CoolInterview.com
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: CoolInterview.com
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: CoolInterview.com
Question: How to provide column names in INSERT Statements in MS SQL Server?

Answer: If you don't want to specify values for columns that have default values, or you want to specify values to columns in an order different than how they are defined, you can provide a column list in the INSERT statement. If a column is omitted in the column, SQL Server applies 3 rules:

* If default value is defined for the column, that default value will be used.
* If no default value is defined for the column and NULL is allowed, NULL will be used.
* If no default value is define Source: CoolInterview.com
Question: What does the CEILING() function do?

Answer: 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. Source: CoolInterview.com
Question: What is the cost threshhold for parallelism in SQL Server 2005?

Answer: 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. Source: CoolInterview.com
Question: How To Enter Unicode Character String Literals in MS SQL Server?

Answer: Unicode characters are multi-byte characters. They are very hard to be entered as string literals, because it requires:

* The SQL client tool to support Unicode characters. The command line tool 'sqlcmd' does not support Unicode. But SQL Server Management Studio does support Unicode.
* A special Unicode character input tool to allow you to enter multi-byte Unicode characters.

But if you know the code value of a Unicode character, you can enter it with the help of the NCH Source: CoolInterview.com
Question: How To View Existing Indexes on an Given Table using sys.indexes?

Answer: Another way to view existing indexes defined for a given table is to use the system view called "sys.indexes". The tutorial exercise shows you how many indexes were defined from the previous tutorial on table "ggl_links":

USE GlobalGuideLineDatabase;
GO

SELECT * FROM sys.indexes WHERE object_id = (
SELECT object_id FROM sys.tables WHERE name = 'ggl_links'
);
GO

object_id name index_id type_desc is_unique

--------- ------------- -- Source: CoolInterview.com

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.078125 Seconds