nerdexam
Microsoft

70-467 · Question #134

You plan to design an application that temporarily stores data in a SQL Azure database. You need to identify which types of database objects can be used to store data for the application. The…

The correct answer is C. temporary tables. Temporary tables are the only SQL Server object type that supports schema modifications via ALTER TABLE during an active session, satisfying the requirement to change a temporary object's structure at runtime.

Role of Transact-SQL and the Database Engine in Enterprise IT

Question

You plan to design an application that temporarily stores data in a SQL Azure database. You need to identify which types of database objects can be used to store data for the application. The solution must ensure that the application can make changes to the schema of a temporary object during a session. Which type of objects should you identify?

Options

  • Acommon table expressions (CTEs)
  • Btable variables
  • Ctemporary tables
  • Dtemporary stored procedures

How the community answered

(63 responses)
  • A
    2% (1)
  • B
    3% (2)
  • C
    94% (59)
  • D
    2% (1)

Why each option

Temporary tables are the only SQL Server object type that supports schema modifications via ALTER TABLE during an active session, satisfying the requirement to change a temporary object's structure at runtime.

Acommon table expressions (CTEs)

Common table expressions are inline query constructs that exist only for the duration of a single statement and cannot be altered or persist data across multiple statements in a session.

Btable variables

Table variables (@table) are declared with a fixed schema at the point of declaration and do not support ALTER TABLE statements, so their structure cannot be changed once declared.

Ctemporary tablesCorrect

Temporary tables (#table) are created in tempdb and persist for the duration of the session or connection that created them. Unlike table variables, they fully support DDL statements such as ALTER TABLE during the session, allowing the application to add, drop, or modify columns after the object has been created - directly meeting the requirement for runtime schema changes.

Dtemporary stored procedures

Temporary stored procedures store executable Transact-SQL code rather than data and are not a mechanism for storing or restructuring application data during a session.

Concept tested: Temporary tables supporting runtime schema modification in a session

Source: https://learn.microsoft.com/en-us/sql/t-sql/statements/create-table-transact-sql

Topics

#temporary tables#SQL Azure#table variables#schema modification

Community Discussion

No community discussion yet for this question.

Full 70-467 Practice