SQL Server Interview Questions & Answers
auto_adminComments off.1)What are the two authentication modes in SQL Server?
There are two authentication modes –
- Windows Mode
- Mixed Mode
Modes can be changed by selecting the tools menu of SQL Server configuration properties and choose security page.
2)What Is SQL Profiler?
SQL Profiler is a tool which allows a system administrator to monitor events in the SQL server. This is mainly used to capture and save data about each event of a file or a table for analysis.
3)What is CHECK constraint?
A CHECK constraint can be applied to a column in a table to limit the values that can be placed in a column. Check constraint is to enforce integrity.
4) Can SQL servers link to other servers?
SQL server can be connected to any database which has OLE-DB provider to give a link. Example: Oracle has an OLE-DB provider which has a link to connect with the SQL server group.
5)What is the SQL server agent?
The SQL Server agent plays a vital role in day to day tasks of SQL server administrator(DBA). Server agent’s purpose is to implement the tasks easily with the scheduler engine which allows our jobs to run at scheduled date and time.
6)What are scheduled tasks in SQL Server?
Scheduled tasks or jobs are used to automate processes that can be run on a scheduled time at a regular interval. This scheduling of tasks helps to reduce human intervention during night time and feed can be done at a particular time. The user can also order the tasks in which it has to be generated.
7)How exceptions can be handled in SQL Server Programming?
Exceptions are handled using TRY—-CATCH constructs and it is handled by writing scripts inside the TRY block and error handling in the CATCH block.
8)What is the purpose of the FLOOR function?
FLOOR function is used to round up a non-integer value to the previous least integer. Example is given
9)Can we check locks in the database? If so, how can we do this lock check?
Yes, we can check locks in the database. It can be achieved by using an in-built stored procedure called sp_lock.
10)What is a Trigger?
Triggers are used to execute a batch of SQL code when insert or update or delete commands are executed against a table. Triggers are automatically triggered or executed when the data is modified. It can be executed automatically on the insert, delete and update operations.
11)What are the types of Triggers?
There are four types of triggers and they are:
- Insert
- Delete
- Update
- Instead of
12)What is an IDENTITY column in insert statements?
IDENTITY column is used in table columns to make that column as Auto incremental number or a surrogate key.
13)What is Bulkcopy in SQL?
A bulk copy is a tool used to copy a large amount of data from Tables. This tool is used to load a large amount of data in SQL Server.
14)How Global temporary tables are represented and their scope?
Global temporary tables are represented with ## before the table name. The scope will be outside the session whereas local temporary tables are inside the session. Session ID can be found using @@SPID
15)What is Collation?
Collation is defined to specify the sort order in a table. There are three types of sort order –
- Case sensitive
- Case Insensitive
- Binary
16) What is UPDATE_STATISTICS command?
UPDATE_STATISTICS command is used to update the indexes on the tables when there is a large number of deletions or modifications or bulk copy occurred in indexes.
17)Which SQL server table is used to hold the stored procedure scripts?
Sys.SQL_Modules is a SQL Server table used to store the script of the stored procedure. Name of the stored procedure is saved in the table called Sys. Procedures.
18)What are Magic Tables in SQL Server?
During DML operations like Insert, Delete, and Update SQL Server create magic tables to hold the values during the DML operations. These magic tables are used inside the triggers for data transaction.
19)What is the difference between SUBSTR and CHARINDEX in the SQL Server?
The SUBSTR function is used to return a specific portion of the string in a given string. But, INSTR function gives a character position in a given specified string.
20)What is the use of FOR Clause?
FOR clause is mainly used for XML and browser options. This clause is mainly used to display the query results in XML format or in the browser.
21)What is the difference between varchar and nvarchar types?
Varchar and nvarchar are the same but the only difference is that nvarhcar can be used to store Unicode characters for multiple languages and it also takes more space when compared with varchar.
Posted in: news