SQL Question Answers - 15 to 20 Hours

Q. Discuss the process of building and executing a Visual Basic .NET stored procedure.

A. You must first write the stored procedure in the Visual Basic .NET language within a Visual Studio .NET class. You then build the project. You must then declare the stored procedure within SQL Server Management Studio Express. Finally, you can execute it just as you would any other stored procedure.

Q. Explain what logical flow is within a stored procedure.

A. Logical flow is when you want to react differently within a stored procedure depending on certain situations. For example, you may want to respond in a special manner if a parameter is passed in as NULL.

Q. Describe the purpose of output parameters.

A. Output parameters enable you to supply information back to the calling program about what happened within the stored procedure.

Q. Explain why you might want to use a temporary table.

A. Temporary tables enable you to perform operations on data as if that data were structured differently than it actually is. For example, using temporary tables, you can join two tables, have the result go to a temporary table, sort the results, and then send the results back to SQL Server. The temporary table is in memory only, so its structure does not have to be stored anywhere.

Q. Explain why error handling is useful.

A. Without error handling, you get the default error handling associated with Visual Basic .NET. This default error handling is probably not what you want. Using custom error handling you can control exactly what happens when an error occurs.


Q. Give an example of where transaction processing may be useful.

A. Transaction processing would be helpful, for example, for an airline ticket processing system. If processing is interrupted during the booking of a flight, you would not want a partial transaction to be entered into the system. Using transaction processing, you ensure that the entire transaction is completed or the processing that has occurred is rolled back.

Q. Discuss the process of building and executing a C# stored procedure.

A. You must first write the stored procedure in the C# language within a Visual Studio 2005 class. You then build the project. You must then declare the stored procedure within SQL Server Management Studio Express. Finally, you can execute it just as you would any other stored procedure.

Q. Explain what the keyword Switch does.

A. The keyword Switch enables you to evaluate a variable and test its value against several conditions, executing the appropriate code based on the satisfied condition.

Q. Describe the purpose of input parameters.

A. Input parameters enable you to supply information to a stored procedure.

Q. Explain why you might want to use a temporary table.

A. Temporary tables enable you to perform operations on data as if that data were structured differently than it actually is. For example, using temporary tables, you can join two tables, have the result go to a temporary table, sort the results, and then send the results back to SQL Server. The temporary table is in memory only, so its structure does not have to be stored anywhere.

Q. Explain why error handling is useful.

A. Without error handling, you get the default error handling associated with C#. This default error handling is probably not what you want. With custom error handling you can control exactly what happens when an error occurs.

Q. Give an example of where transaction processing may be useful.

A. Transaction processing would be helpful, for example, for an airline ticket processing system. If processing is interrupted during the booking of a flight, you would not want a partial transaction to be entered into the system. Using transaction processing, you ensure that the entire transaction is completed or the processing that has occurred is rolled back.

Q. Explain the difference between a breakpoint and a watch.

A. A breakpoint is an unconditional point at which you want to suspend code execution, whereas a watch is a condition under which you want to suspend code execution.

Q. Explain the difference between Step Into, Step Over, and Step Out.

A. Step Into executes code one line at a time. You use Step Over to execute a subroutine or function without stepping through its code. Finally, you use Step Out to execute the remainder of a subroutine or function without stepping through its code. You return to the procedure that called the subroutine or function in which you were.

Q. Explain the call stack.

A. The call stack shows you which functions the code called to bring you to a specific point in code execution.

No comments: