MSSQL Objective Questions & Answers for Professionals Set-3
1. What is the purpose of the SQL Server function GETUTCDATE()?
Explanation: The GETUTCDATE() function in SQL Server is used to retrieve the current date and time
2. Which SQL Server system function is used to retrieve the current user's login name?
Explanation: The USER_NAME() function in SQL Server is used to retrieve the current user's login name.
3. What is the purpose of the SQL Server function LEFT()?
Explanation: The LEFT() function in SQL Server is used to extract a specified number of characters from the beginning of a string.
4. Which of the following SQL Server statements is used to rename a table?
Explanation: The EXEC sp_rename statement in SQL Server is used to rename a table.
5. In SQL Server, what is the purpose of the keyword "OPTIMIZE FOR" in a query?
Explanation: The "OPTIMIZE FOR" keyword in a query in SQL Server is used to optimize the execution plan for a specific parameter value.
6. Which SQL Server system view provides information about the current database connections and their status?
Explanation: The sys.dm_exec_connections view in SQL Server provides information about the current database connections and their status.
7. In SQL Server, what is the purpose of the keyword "EXCEPT" in a query?
Explanation: The "EXCEPT" keyword in a query in SQL Server is used to find the rows that are unique to the first query but not present in the second query.
8. Which SQL Server system view provides information about the execution plans of cached queries?
Explanation: The sys.dm_exec_cached_plans view in SQL Server provides information about the execution plans of cached queries.
9. Which SQL Server statement is used to grant permissions to a user or role on an object?
Explanation: The GRANT statement in SQL Server is used to grant permissions to a user or role on an object.
10. What is the purpose of the SQL Server function XML PATH()?
Explanation: The XML PATH() function in SQL Server is used to concatenate values from multiple rows into a single string using an XML format.
11. Which SQL Server system view provides information about the database schema, such as tables, columns, and indexes?
Explanation: The sys.objects view in SQL Server provides information about the database schema, including tables, columns, indexes, and other objects.
12. In SQL Server, what is the purpose of the function LAG()?
Explanation: The LAG() function in SQL Server is used to retrieve the previous row's value in the result set, based on a specified column's ordering.
13. What is the purpose of the SQL Server function FORMAT()?
Explanation: The FORMAT() function in SQL Server is used to format numeric and date/time values as strings according to a specified format.
14. In SQL Server, what is the purpose of the keyword "OVER" in a window function?
Explanation: The "OVER" keyword in a window function in SQL Server is used to group the result set into partitions, which is essential for performing the window function's calculations.
15. In SQL Server, what is the purpose of the keyword "PIVOT" in a query?
Explanation: The "PIVOT" keyword in a query in SQL Server is used to transform rows into columns based on the values in a specific column.
Rate Your Experience
: 89
: 1