.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Lee Hnetinka
mithun


Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.


Post New Question Subscribe to Interview Questions
 
Quick Links For Interview Questions Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  OOPs  JQuery  JavaScript/VBScript
BiztalkPatten/PracticesIISWCFWPFWWF
NetworkingAptitudeOthers  All    
 

Sql Server Interview Questions and Answers

What are System Stored Procedures?

Author: abhays          Posted Date: October 15, 2014    Category: Sql Server     Points: 40

These are special type of Stored Procedures created in MASTER database and accessible in any other database within the server. Rules to create System Stored Procedures:
Name should start with SP_
Should be created in MASTER database only

What is CHARINDEX in SQL

Author: abhays          Posted Date: October 15, 2014    Category: Sql Server     Points: 40

CHARINDEX( findTextData, textData, [startingPosition] ) - Returns the starting position of the specified expression in a character string. The starting position is optional.

How many types of triggers

Author: abhays          Posted Date: September 26, 2014    Category: Sql Server     Points: 40

There are three types of triggers.
DML Triggers
--> AFTER Triggers
--> INSTEAD OF Triggers
DDL Triggers
CLR Triggers

What is the difference between char , varchar and nvarchar?

Author: abhays          Posted Date: September 26, 2014    Category: Sql Server     Points: 40

char(n)Fixed length non unicode character data with length of n bytes.n must be a value from 1 through 8,000.

varchar(n)variable length non unicode character data with length of n bytes.

nvarchar(n)variable length unicode character data of n characters. n must be a value from 1 through 4,000.

What is the difference between SET and SELECT?

Author: abhays          Posted Date: September 26, 2014    Category: Sql Server     Points: 40

Both SET and SELECT can be used to assign values to variables. It is recommended that SET @local_variable be used for variable assignment rather than SELECT @local_variable.
Examples
declare @i int
set @i=1
This is used to assign constant values.

select @i=max(column_name)from table_name
for ex.
select @i=max(emp_id) from table_emp.

What are the System Database in Sql server

Author: abhays          Posted Date: September 26, 2014    Category: Sql Server     Points: 40

Master - Stores system level information such as user accounts, configuration settings, and info on all other databases.

Model - database is used as a template for all other databases that are created

Msdb - Used by the SQL Server Agent for configuring alerts and scheduled jobs etc

Tempdb - Holds all temporary tables, temporary stored procedures, and any other temporary storage requirements generated by SQL Server.

How to change the password of sa login in sql server?

Author: Subhransu Sekhar Jena          Posted Date: September 26, 2014    Category: Sql Server     Points: 40

Open SQL Server.

Login into sa account using your old password.

Then open your Object Explorer or press f8.

Then expand security section.

After This Expand your login Section. Wher you can see the user "sa".

Right click on sa. Click on Properties.

Then Write your new password in password and confirm password textboxes.

Then Check the CheckBox "Specify Old Password" and Write your old Password.

Then click on OK Button.

How to check the performance of SQL queries.

Author: Ashutosh Jha          Posted Date: August 31, 2014    Category: Sql Server     Points: 40

Sql Queries performance can be checked by using the Query optimization. we can check the query execution plan that how much time the query is taking to execute and then we can find-out that which part of the query is taking more time. The issue could e incorrect joins which is leading for more time to get the results. or in-proper sub-queries. By query execution plan, we can track the execution of the queries and then optimize it if required.

what is SQL Profiler.

Author: Ashutosh Jha          Posted Date: August 31, 2014    Category: Sql Server     Points: 40

Sql Profiler is a tool in the Sql Server management Studio which is mainly used to track the data from the front end. It is used to see the actual execution of the queries, stored procedure for the input data. So by using this tool, we can check all the input data which is coming from the front end or from another queries and can validate that data against the actual data. This tool is mainly used for fixing the issues related to the database.

What are the differences between Stored procedure and function.

Author: Ashutosh Jha          Posted Date: August 31, 2014    Category: Sql Server     Points: 40

Below are the main differences between stored procedure and functions-
1.Function has a return type but Stored procedure doesn't have a return type.
2.Stored Procedure supports IN/OUT/IN-OUT Parameters while function supports only IN parameters.
3.Stored procedure can contain all the DML(Select,update,insert,delete) statements but function can contain only select statement.
4.Function can be called from a stored procedure but stored procedure cannot be executed from a function.
5.For Exception Handling, the stored procedure can contain try---catch block but Function doesn't support try---catch block.




Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend