All fields

“Stored Procedures & Functions” in Information Technology

41 questions across 1 technology.

Information Technology

41 questions in 1 technology

#QuestionTechnologyTopicLevel
1How does SQL Server compile and cache execution plans for stored procedures, and how does this affect performance compared to ad hoc queries? SQL Server › Stored Procedures & FunctionsSQL ServerStored Procedures & FunctionsAdvanced
2What are the main differences between a stored procedure and a function in terms of what each one can and cannot do? SQL Server › Stored Procedures & FunctionsSQL ServerStored Procedures & FunctionsIntermediate
3What is a stored procedure in SQL Server, and what are the main benefits of using one? SQL Server › Stored Procedures & FunctionsSQL ServerStored Procedures & FunctionsBeginner
4How do you use output parameters in a stored procedure to return a value back to the calling code, in addition to or instead of a normal result set? SQL Server › Stored Procedures & FunctionsSQL ServerStored Procedures & FunctionsIntermediate
5What is the difference between using EXEC and calling a stored procedure through parameterized application code, and why does this distinction matter for security? SQL Server › Stored Procedures & FunctionsSQL ServerStored Procedures & FunctionsIntermediate
6How would you design a stored procedure to handle a complex business process involving multiple steps, proper error handling, and transaction management together? SQL Server › Stored Procedures & FunctionsSQL ServerStored Procedures & FunctionsAdvanced
7What is the difference between a scalar function and a table valued function in SQL Server? SQL Server › Stored Procedures & FunctionsSQL ServerStored Procedures & FunctionsBeginner
8What restrictions exist on what a user defined function is allowed to do compared to a stored procedure? SQL Server › User Defined FunctionsSQL ServerUser Defined FunctionsIntermediate
9What are natively compiled stored procedures, and how do they work together with memory optimized tables? SQL Server › In-Memory OLTP (Memory-Optimized Tables)SQL ServerIn-Memory OLTP (Memory-Optimized Tables)Intermediate
10What is a user defined function in SQL Server, and why would you create one instead of repeating the same logic in multiple queries? SQL Server › User Defined FunctionsSQL ServerUser Defined FunctionsBeginner
11Why can calling a scalar user defined function within a query against a large table cause significant performance problems? SQL Server › User Defined FunctionsSQL ServerUser Defined FunctionsIntermediate
12What are the tradeoffs between implementing complex reusable business logic as a user defined function versus building it directly into application code? SQL Server › User Defined FunctionsSQL ServerUser Defined FunctionsAdvanced
13What error information functions are available inside a CATCH block to help you understand what went wrong? SQL Server › Error Handling with TRY CATCHSQL ServerError Handling with TRY CATCHBeginner
14How would you build a dynamic SQL statement inside a stored procedure that constructs a flexible search query based on several optional filter parameters? SQL Server › Dynamic SQLSQL ServerDynamic SQLAdvanced
15How do nested TRY CATCH blocks work, and when would you use them in a complex stored procedure? SQL Server › Error Handling with TRY CATCHSQL ServerError Handling with TRY CATCHAdvanced
16What is a cursor in SQL Server, and why do most developers try to avoid using them? SQL Server › CursorsSQL ServerCursorsBeginner
17What is dynamic SQL, and why would you need to build and execute a SQL statement as a string rather than writing it directly? SQL Server › Dynamic SQLSQL ServerDynamic SQLBeginner
18What is SQL injection, and how does it relate to writing dynamic SQL unsafely? SQL Server › Dynamic SQLSQL ServerDynamic SQLBeginner
19How does a TRY CATCH block work in SQL Server, and why is it useful? SQL Server › Error Handling with TRY CATCHSQL ServerError Handling with TRY CATCHBeginner
20What is SQL Server Agent, and what kinds of tasks is it typically used to automate? SQL Server › SQL Server Agent & Job SchedulingSQL ServerSQL Server Agent & Job SchedulingBeginner
21How do you create a basic SQL Server Agent job that runs a T-SQL script on a defined schedule? SQL Server › SQL Server Agent & Job SchedulingSQL ServerSQL Server Agent & Job SchedulingBeginner
22What is a local temporary table in SQL Server, and how is it different from a regular permanent table? SQL Server › Temporary Tables & Table VariablesSQL ServerTemporary Tables & Table VariablesBeginner
23What is a table variable in SQL Server, and how is it declared and used? SQL Server › Temporary Tables & Table VariablesSQL ServerTemporary Tables & Table VariablesBeginner
24What is T-SQL, and how does it relate to standard SQL? SQL Server › T-SQL Fundamentals & SyntaxSQL ServerT-SQL Fundamentals & SyntaxBeginner
25How do you declare and use a variable in T-SQL? SQL Server › T-SQL Fundamentals & SyntaxSQL ServerT-SQL Fundamentals & SyntaxBeginner
26What are the basic steps required to declare, open, use, and properly clean up a cursor? SQL Server › CursorsSQL ServerCursorsIntermediate
27What does the FAST_FORWARD cursor option do, and when should you use it? SQL Server › CursorsSQL ServerCursorsIntermediate
28How would you build a dynamic SQL query where the table or column names themselves need to change based on input, since parameters cannot be used for object names? SQL Server › Dynamic SQLSQL ServerDynamic SQLIntermediate
29How do you debug a dynamic SQL statement when it fails or does not produce the expected results? SQL Server › Dynamic SQLSQL ServerDynamic SQLIntermediate
30What is the difference between using THROW and RAISERROR to raise a custom error in SQL Server? SQL Server › Error Handling with TRY CATCHSQL ServerError Handling with TRY CATCHIntermediate
31What types of errors cannot be caught by a TRY CATCH block in SQL Server? SQL Server › Error Handling with TRY CATCHSQL ServerError Handling with TRY CATCHIntermediate
32How do you generate JSON formatted output directly from a SQL query's result set? SQL Server › JSON Support in SQL ServerSQL ServerJSON Support in SQL ServerIntermediate
33What is parameter sniffing, and how can it sometimes lead to unexpectedly poor query performance? SQL Server › Query Optimization & PlansSQL ServerQuery Optimization & PlansIntermediate
34How do you force SQL Server to use a specific, previously known good execution plan for a query using Query Store? SQL Server › Query StoreSQL ServerQuery StoreIntermediate
35How do you grant and revoke specific permissions, such as SELECT or EXECUTE, on individual database objects rather than through broader roles? SQL Server › SQL Server Security & PermissionsSQL ServerSQL Server Security & PermissionsIntermediate
36What is the difference between a batch and a transaction in T-SQL, and how does the GO keyword relate to batches? SQL Server › T-SQL Fundamentals & SyntaxSQL ServerT-SQL Fundamentals & SyntaxIntermediate
37How would you rewrite a common cursor based row by row update into an equivalent, much faster set based UPDATE statement? SQL Server › CursorsSQL ServerCursorsAdvanced
38In what rare situations might using a cursor still be a reasonable choice despite the general recommendation to avoid them? SQL Server › CursorsSQL ServerCursorsAdvanced
39How would you build a centralized, reusable error logging procedure that captures detailed error information whenever it is called from within a CATCH block? SQL Server › Error Handling with TRY CATCHSQL ServerError Handling with TRY CATCHAdvanced
40How do you use the SQL Server Query Store feature to identify and address query performance regressions over time? SQL Server › Query Optimization & PlansSQL ServerQuery Optimization & PlansAdvanced
41How would you design a complex SQL Server Agent job with multiple steps that need to run conditionally based on the success or failure of previous steps? SQL Server › SQL Server Agent & Job SchedulingSQL ServerSQL Server Agent & Job SchedulingAdvanced