SQL SERVER INTERVIEW QUESTIONS 2014- SET 8 By 
"Mr.J.Venkatesan Prabu" 
KAASHIV INFOTECH
"Mr.J.Venkatesan Prabu"
1. What is the difference between UNION and UNION ALL?
- UNION The UNION command is used to select related
     information from two tables, much like the JOIN command. However, when
     using the UNION command all selected columns need to be of the same data
     type. With UNION, only distinct values are selected.
 
- UNION ALL The UNION ALL command is
     equal to the UNION command, except that UNION ALL selects all values.
The difference between Union and Union all is that Union all will not
eliminate duplicate rows, instead it just pulls all rows from all tables
fitting your query specifics and combines them into a table.
2. What is B-Tree?
The database server uses a B-tree structure to organize
index information. B-Tree generally has following types of index pages or
nodes:
- root node: A root node contains node
     pointers to branch nodes which can be only one.- branch node: A branch node contains
     pointers to leaf nodes or other branch nodes which can be two or more.- leaf nodes: A leaf node contains index
     items and horizontal pointers to other leaf nodes which can be many.
3. What is the difference
between lock, block and deadlock?
Lock: DB engine
locks the rows/page/table to access the data which is worked upon according to
the query.
Block: When one process blocks the resources of
another process then blocking happens. Blocking can be identified by using
SELECT * FROM sys.dm_exec_requests where blocked
<> 0
SELECT * FROM master..sysprocesses where blocked
<> 0
Deadlock: When something happens as follows:
Error 1205 is reported by SQL Server for deadlock.
4.What is the meaning of lock escalation and why/how to stop
this?
When the DB engine
would try to lock page first and then it escalates locks to page and then
table. If we understand that whole table would be locked for the processing
thenn this is better to use TABLOCK hint and get complete table blocked. This
is a nice way to avoid the wastage of sql server DB engine processing for lock
escalation. Somewhere you may also need to use TABLOCKX when you want an
exclusive lock on the table in the query.
1. find the spid which you want to analyze. An spid is assigned as soon as a
client connection is established with the SQL server. To find the spid you can
run any of the following command:
a) SP_WHO2 ‘ACTIVE’ — This will give you only active spids.
b) SELECT * FROM sys.dm_exec_requests  
a) dbcc inputbuffer()
b) sql2005 and sql2008 – SELECT * FROM sys.dm_exec_sql_text()
c) sql2005 and sql2008 – SELECT * FROM fn_get_sql()   
go
sp_dboption dbname, single, true
EXEC xp_readerrorlog
SELECT * FROM #Errorlog
WHERE Text Like ‘%SINGLE%USER%’
Block: When one process blocks the resources of another process then blocking happens. Blocking can be identified by using
SELECT * FROM sys.dm_exec_requests where blocked <> 0
SELECT * FROM master..sysprocesses where blocked <> 0
Deadlock: When something happens as follows: Error 1205 is reported by SQL Server for deadlock.
1. find the spid which you want to analyze. An spid is assigned as soon as a client connection is established with the SQL server. To find the spid you can run any of the following command:
a) SP_WHO2 ‘ACTIVE’ — This will give you only active spids.
b) SELECT * FROM sys.dm_exec_requests
a) dbcc inputbuffer(
b) sql2005 and sql2008 – SELECT * FROM sys.dm_exec_sql_text(
c) sql2005 and sql2008 – SELECT * FROM fn_get_sql(
go
sp_dboption dbname, single, true
EXEC xp_readerrorlog
SELECT * FROM #Errorlog
WHERE Text Like ‘%SINGLE%USER%’
12. What does the NOLOCK query hint do?
Table hints allow you to override the
default behavior of the query optimizer for statements. They are specified in
the FROM clause of the statement. While overriding the query optimizer is not
always suggested, it can be useful when many users or processes are touching
data. The NOLOCK query hint is a good example because it allows you to read
data regardless of who else is working with the data; that is, it allows a
dirty read of data -- you read data no matter if other users are manipulating
it. A hint like NOLOCK increases concurrency with large data stores.SELECT * FROM table_name (NOLOCK)
Microsoft advises against using
NOLOCK, as it is being replaced by the READUNCOMMITTED query hint. There
are lots more query hints with plenty of information online.
There are quite a lot of changes and enhancements in SQL Server
2005. Few of them are listed here :
14. What are
the High-Availability solutions in SQL Server and differentiate them
briefly.
15. How do you
troubleshoot errors in a SQL Server Agent Job?
There are quite a lot of changes and enhancements in SQL Server 2005. Few of them are listed here :
| 
Day | 
Programme | 
| 
 Day 1 | 
BigData (Practical Demos) | 
| 
Day 2 | 
Windows 8 App Development (Practical Demos) | 
| 
Day 3 | 
Ethical Hacking (Facebook Hack,Server/Website Hacking(20 Attacks)  | 
| 
Day 4 | 
Cloud Computing (Live Server Demo,Live Pjt Implementation) | 
| 
Day 5 | 
CCNA (-Networking-Router Configurations Practical Demo) | 
| 
Day | 
Programme | 
| 
Day 1 | 
Embedded System  (Embedded Program Designing ,Chip Burning) | 
| 
Day 2 | 
Wireless System  (Device Designing,Controlling Fans with Wireless Sensors) | 
| 
Day 3 | 
CCNA  (-Networking-Router Configurations Practical Demo) | 
| 
Day 4 | 
Ethical Hacking  (Facebook Hack,Server/Website Hacking(20 Attacks) | 
| 
Day 5 | 
Matlab  (Capture Image,Processing, Animate Images-Practical Demos) | 
Mechanical/Civil Inplant training Schedule
| 
Day | 
Programme | 
| 
Day 1 | 
Aircraft Designing | 
| 
Day 2 | 
Vehicle Movement in Airports | 
| 
Day 3 | 
3D Packaging Designs | 
| 
Day 4 | 
3D Modeling | 
| 
Day 5 | 
3D Window Shading | 
Shivanantha Building,
X41, 5th Floor,2nd Avenue,
(Near Ayyappan Temple)
Anna Nagar, Chennai = 600040.



 
 
 
 
 
 
 
No comments:
Post a Comment