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.
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)- A4% (1)
- B13% (3)
- C8% (2)
- E75% (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.
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.
SELECT...INTO creates a brand-new table from a query result and cannot insert data into an existing fact table.
ALTER PARTITION-SWITCH is not valid T-SQL syntax; the correct statement for a partition switch is ALTER TABLE...SWITCH.
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.
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
Community Discussion
No community discussion yet for this question.