nerdexam
Microsoft

70-467 · Question #93

You need to select a method of moving data from the staging tables to the factOrders table. What type of Transact-SQL (T-SQL) statement should you use?

The correct answer is E. ALTER TABLE...SWITCH. ALTER TABLE...SWITCH is the correct T-SQL statement for partition switching, allowing bulk data movement from a staging table into a partitioned fact table as a near-instantaneous metadata operation.

Design an ETL solution (Extract, Transform, and Load)

Question

You need to select a method of moving data from the staging tables to the factOrders table. What type of Transact-SQL (T-SQL) statement should you use?

Options

  • AINSERT INTO...SELECT
  • BSELECT...INTO
  • CALTER PARTITION-SWITCH
  • DALTER PARTITION FUNCTION
  • EALTER TABLE...SWITCH

How the community answered

(24 responses)
  • A
    4% (1)
  • B
    13% (3)
  • C
    8% (2)
  • E
    75% (18)

Why each option

ALTER TABLE...SWITCH is the correct T-SQL statement for partition switching, allowing bulk data movement from a staging table into a partitioned fact table as a near-instantaneous metadata operation.

AINSERT INTO...SELECT

INSERT INTO...SELECT physically copies rows one at a time within a transaction, which is slow for large fact table loads and does not leverage partition architecture.

BSELECT...INTO

SELECT...INTO creates a brand-new table from a query result and cannot insert data into an existing fact table.

CALTER PARTITION-SWITCH

ALTER PARTITION-SWITCH is not valid T-SQL syntax; the correct statement for a partition switch is ALTER TABLE...SWITCH.

DALTER PARTITION FUNCTION

ALTER PARTITION FUNCTION adds or removes a boundary point to change the number of partitions in a partition function, and does not move data between tables.

EALTER TABLE...SWITCHCorrect

ALTER TABLE...SWITCH reassigns a partition or an entire table to a target partition by updating metadata only, without physically moving rows, which makes it extremely fast for loading large volumes of staged data into a fact table. This is the standard ETL pattern for loading data warehouse fact tables because it avoids full table scans and row-by-row inserts. The staging table must match the structure and constraints of the target partition for the switch to succeed.

Concept tested: Partition switching for fast fact table loading

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

Topics

#ALTER TABLE SWITCH#partition switching#staging tables#ETL T-SQL

Community Discussion

No community discussion yet for this question.

Full 70-467 Practice