Sql Server Interview Questions and Answers (1758) - Page 63

You are inserting some values into Table but your Insert Statements Fails.So what may be the reasons?

Some of the most common errors which occur while executing INSERT statement:-
A).There is a mismatch between the number of columns and the number of values
B).If the datatype of an inserted value is a mismatch with the column of the target table
C).There is a size mismatch between a value and its target column.
D).When a column is defines as not NULL and the insertion value is NULL.
When does Delete statement fails?

Mostly Delete statement fails:-
When there is a violation of Foreign key meaning that idf we delete a parent key but it's references are present on child table.
When there is written wrong statement as Delete * from tablename.
When supplied column is not present.
When the column value has different datatype.
What are the Magic Tables in Sql server?

Sql Server automatically creates and manages two temporary,memory-resident tables that are called as Deleted and Inserted tables which are popularly known as Magic Tables.
Usually these magic tables are used with the DML triggers.We Can not directly modify the data in the tables or perform ddl operation.
Primarily used to perform certain action like-

1). Extend referential integrity between tables.
2). Test for errors and take action based on the error.
3). Find the difference between the state of a table before and after data modification and take actions based on that difference.
What is the correct syntax?

NOTE: This is objective type question, Please click question title for correct answer.
Drop statement does which operation?

NOTE: This is objective type question, Please click question title for correct answer.
What type of join is needed when we want such rows that do not have matching values?

NOTE: This is objective type question, Please click question title for correct answer.
What type of join is required when we wish to return rows that do have matching values?

NOTE: This is objective type question, Please click question title for correct answer.
Which of the following statement is true concerning a stored procedure?

NOTE: This is objective type question, Please click question title for correct answer.
A Case Sql statement consists of the following?

NOTE: This is objective type question, Please click question title for correct answer.
Which of the following statements is true concerning routines and triggers?

NOTE: This is objective type question, Please click question title for correct answer.
How to get particular part of string in SQL Server?

We have to use Substring method to achieve the same as:-
For Example:-
SELECT SUBSTRING('Vishal Kumar',1,6);

Output
Vishal


SELECT SUBSTRING('Vishal Kumar',7,6);

Output
Kumar

What are the benefits of Stored procedure over inline queries?

1). Improved Performance : Database can optimize the data access plan used by procedure and cache it for subsequent reuse.

2). Security : Stored proceudre can be individually secured within the database. A client can be granted permissions to execute SP without having any permission on the underlying tables.

3). Easy to maintain : easier to modify a stored procedure than it is to change a hard-coded sql statement.

4). Reduce network traffice : Sql statement can be executed in batches rather than sending multiple requests from the client
Found this useful, bookmark this page to the blog or social networking websites. Page copy protected against web site content infringement by Copyscape

 Interview Questions and Answers Categories