SQL SERVER INTERVIEW QUESTIONS 2014- SET 11 By
"Mr.J.Venkatesan Prabu"
KAASHIV INFOTECH
[ The Asia, India & Tamil Nadu Book Of Record Holders ]
SQL Server Interview Questions 2014
- Gives you the interview tips for SQL Server
SQL SERVER INTERVIEW QUESTIONS WITH ANSWERS
1.
Why we cannot use column alias in where
clause but we can use it in order by clause of select statement in sql server?
For example, it is incorrect to write:
SELECT Roll_No AS Id From Student WHERE Id > 1
While it correct:
SELECT Roll_No AS Id From Student ORDER BY Id
In sql server order of execution of different clauses of a select statement
is following order:
Clause of select statement
|
Execution order
|
FROM
|
1
|
ON
|
2
|
JOIN
|
3
|
WHERE
|
4
|
GROUP BY
|
5
|
WITH CUBE or WITH ROLLUP
|
6
|
HAVING
|
7
|
SELECT
|
8
|
DISTINCT
|
9
|
ORDER BY
|
10
|
TOP
|
11
|
It is clear the WHERE clause executes before the SELECT clause so WHERE
clause has no knowledge about column alias of SELECT clause while ORDER BY
clause executes after the SELECT clause so it know about column alias of SELECT
clause.
2.Which
command using Query Analyzer will give you the version of SQL server and
operating system?
SELECT SERVERPROPERTY ('productversion'), SERVERPROPERTY
('productlevel'), SERVERPROPERTY ('edition').
3. What
is SQL Server Agent?
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.
4. Can a
stored procedure call itself or recursive stored procedure? How much level SP
nesting is possible?
Yes. Because Transact-SQL supports recursion, you can write stored
procedures that call themselves. Recursion can be defined as a method of
problem solving wherein the solution is arrived at by repetitively applying it
to subsets of the problem. A common application of recursive logic is to
perform numeric computations that lend themselves to repetitive evaluation by
the same processing steps. Stored procedures are nested when one stored
procedure calls another or executes managed code by referencing a CLR routine,
type, or aggregate. You can nest stored procedures and managed code references
up to 32 levels.
5. What
is Log Shipping?
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. If one server fails, the other
server will have the same db and can be used this as the Disaster Recovery
plan. The key feature of log shipping is that it will automatically backup
transaction logs throughout the day and automatically restore them on the
standby server at defined interval.
6. Name
3 ways to get an accurate count of the number of records in a table?
SELECT * FROM table1
SELECT COUNT(*) FROM table1
SELECT rows FROM sysindexes WHERE id =
OBJECT_ID(table1) AND indid < 2
7. What
does it mean to have QUOTED_IDENTIFIER ON? What are the implications of having
it OFF?
When SET QUOTED_IDENTIFIER is
ON, identifiers can be delimited by double quotation marks, and literals must
be delimited by single quotation marks. When SET QUOTED_IDENTIFIER is OFF,
identifiers cannot be quoted and must follow all Transact-SQL rules for
identifiers.
8.What is NOT NULL Constraint?
A NOT NULL constraint enforces that the column will not
accept null values. The not null constraints are used to enforce domain
integrity, as the check constraints.
9. How to get @@ERROR and @@ROWCOUNT at the same time?
If @@Rowcount is checked after Error checking statement
then it will have 0 as the value of @@Recordcount as it would have been reset.
And if @@Recordcount is checked before the error-checking statement then
@@Error would get reset. To get @@error and @@rowcount at the same time do both
in same statement and store them in local variable.
SELECT @RC = @@ROWCOUNT, @ER = @@ERROR
10. What is a Scheduled Jobs or What is a Scheduled Tasks?
Scheduled tasks let user automate
processes that run on regular or predictable cycles. User can schedule
administrative tasks, such as cube processing, to run during times of slow
business activity. User can also determine the order in which tasks run by
creating job steps within a SQL Server Agent job. E.g. back up database, Update
Stats of Tables. Job steps give user control over flow of execution. If one job
fails, user can configure SQL Server Agent to continue to run the remaining
tasks or to stop execution.
11. What are the advantages of using Stored Procedures?
- Stored procedure can reduced network traffic and
latency, boosting application performance.
- Stored procedure execution plans can be reused,
staying cached in SQL Server's memory, reducing server overhead.
- Stored procedures help promote code reuse.
- Stored procedures can encapsulate logic. You can
change stored procedure code without affecting clients.
- Stored procedures provide better security to your
data.
12. What is a table called, if it has neither Cluster nor
Non-cluster Index? What is it used for?
Unindexed table or Heap. Microsoft
Press Books and Book on Line (BOL) refers it as Heap. A heap is a table that
does not have a clustered index and, therefore, the pages are not linked by pointers.
The IAM pages are the only structures that link the pages in a table together.
Unindexed tables are good for fast storing of data. Many times it is better to
drop all indexes from table and then do bulk of inserts and to restore those
indexes after that.
13. Can SQL Servers linked to other servers like Oracle?
SQL Server can be linked to any server
provided it has OLE-DB provider from Microsoft to allow a link. E.g. Oracle has
an OLE-DB provider for oracle that Microsoft provides to add it as linked server
to SQL Server group.
14. How do you
load large data to the SQL server database?
BulkCopy
is a tool used to copy huge amount of data from tables. BULK INSERT command
helps to Imports a data file into a database table or view in a user-specified format.
15. What is Self Join?
This
is a particular case when one table joins to itself, with one or two aliases to
avoid confusion. A self join can be of any type, as long as the joined tables
are the same. A self join is rather unique in that it involves a relationship
with only one table. The common example is when company has a hierarchal
reporting structure whereby one member of staff reports to another.
KaaShiv InfoTech Offers Best Inpant Training in Chennai.
The training at KAASHIV INFOTECH focus on developing the technical oriented concepts that turn graduates into employable assets. Handled only by professionals from MNC companies, we know how to equip you with strong technologies fundamentals.
INPLANT TRAINING SCHEDULE FOR CSE/IT/MCA STUDENTS
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)
|
INPLANT TRAINING SCHEDULE FOR ELECTRONIC/ELECTRICAL/EIE STUDENTS
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
|
Address:
KAASHIV INFO TECH
Shivanantha Building,
X41, 5th Floor,2nd Avenue,
(Near Ayyappan Temple)
Anna Nagar, Chennai = 600040.
Contact Number : 9840678906 ,9003718877 , 9962345637 .
Visit our other websites
http://www.inplanttrainingchennai.com
http://www.inplanttraining-in-chennai.com
http://www.Kaashiveinotech.com
http://www.internshipinchennai.in
https://plus.google.com/u/0/b/110228862465265998202/dashboard/overview
https://plus.google.com/u/0/b/117408505876070870512/dashboard/overview
https://plus.google.com/u/0/b/104468163439231303834/dashboard/overview
https://plus.google.com/u/0/b/117640664472494971423/dashboard/overview
Feedback URLS
KaaShiv InfoTech Facebook Page
https://www.facebook.com/KaaShivInfoTech
Inplant Training Program in Chennai
https://www.facebook.com/pages/Inplant-Training-Program-in-Chennai/1402097696706380
Internship Training Program in Chennai
https://www.facebook.com/pages/Internship-in-Chennai-KaaShiv/1446147235603704
Facebook Inplant Training page
https://www.facebook.com/pages/Inplant-Training/256116284550327
No comments:
Post a Comment