Microsoft SQL Server Stage
Applies to
Platform: Microsoft SQL Server
Architecture: Stage
Microsoft SQL Server Stage generates a Stage layer for SQL Server as T-SQL scripts with stored procedure loaders. Select the Generator Configuration Microsoft SQL Server Stage when you add a project whose Stage layer reads source databases directly.
For CSV files use Microsoft SQL Server Stage Files, and for sources that SQL Server reaches with OPENQUERY use Microsoft SQL Server Stage OpenQuery.
Scope and output
- Platform: Microsoft SQL Server.
- Layers: Source and Stage. Dataflow Modeling shows Stage in the Bronze column. See Understand the Layering concept.
- Output: the layer script
SQL\L010_Stage.sql, the load control scripts or an Airflow DAG, and the PowerShell 7 scripts that deploy and load, described in Microsoft SQL Server - Artifacts.
Each arrow in the diagram is a dataflow between two layers:

Prerequisites
- A SQL Server instance and a login that can create the databases, schemas and objects of the layers and the load control. The deployment creates missing databases, with the recovery model
SIMPLE, and schemas. - PowerShell 7 and sqlcmd on the machine that deploys.
The setup is described in Microsoft SQL Server - Target environment, the placeholders in Microsoft SQL Server - Placeholder values.
Sources and linked projects
Stage source views read each source table by its four-part name [<server>].[<database>].[<schema>].[<table>]. The server name stays empty for a source database on the same instance; otherwise it is the name of a linked server. The discovery types are listed in Source systems per generator configuration, and Discover a Microsoft SQL Server database creates the source model objects.
You can export this project as a linked project. The configuration cannot import linked projects.
Supported model objects
Capabilities and limitations
- Generated objects per Stage: the table
STG_ST_<model object name>, the views_Sourceand_Result, and the loader_Loader. A deduplication adds the view_Deduplication. - Implementation Type
Virtualcreates only the source and result views, without table and loader. - Loader: it truncates the table, then inserts the rows of the source view in a transaction.
- Keys: Stage tables have no primary key and no hash columns. Increment tables
<table name>_Incrementhave the identity columnBG_ID INT IDENTITY. - Indexes: Index management offers clustered and nonclustered rowstore and columnstore indexes, unique indexes and Included Columns.
- Deployment: with the default Deployment Options, each deployment drops and creates the tables again. See Microsoft SQL Server - Deployment.
Project properties
The configuration offers no Hash Algorithm. It offers these project properties, with their defaults:
- Begin of Universe:
19000101 - Create Result Views: on
- Target Object Comment Type:
None; alsoTablesandTables and Views - Artifact Output Mode:
Layer Composites; alsoDeployment Objects - Deployment Options:
Generate Drop Table Statements - Configure LoadControl: on
- Deploy LoadControl: on
- LoadControl Options:
Native Load Control; alsoAirflow
Data types
Default Term data types by platform lists the data types of the Default Terms on Microsoft SQL Server.
Platform differences
These profiles compare their configuration with this one:
- Snowflake Stage
- Databricks Stage
- Databricks Stage JDBC
- Fabric Lakehouse Stage
- Fabric Lakehouse Stage JDBC
- Fabric Warehouse Stage
- Oracle Stage
Example
A Stage dataflow_aggregation counts the duplicate IDs per customer of the source table CUSTOMER_DUPLICATES. It generates this table and source view. The excerpt shows the example schema st and the source database BFM with the schema dbo in place of the placeholders, with an empty server name:
CREATE TABLE [st].[STG_ST_dataflow_aggregation] (
[BG_LoadTimestamp] DATETIMEOFFSET NOT NULL
,[BG_SourceSystem] NVARCHAR(255) NULL
,[CUSTOMER_ID] INT NOT NULL
,[DUPLICATE_CUSTOMER_COUNT] INT NULL
)
;
CREATE VIEW [st].[STG_ST_dataflow_aggregation_Source]
AS
SELECT
CAST(NULL AS DATETIMEOFFSET) AS [BG_LoadTimestamp]
,CAST(NULL AS NVARCHAR(255)) COLLATE DATABASE_DEFAULT
AS [BG_SourceSystem]
,[s1].[CUSTOMER_ID] AS [CUSTOMER_ID]
,COUNT_BIG(DISTINCT [s1].[DUPLICATE_CUSTOMER_ID])
AS [DUPLICATE_CUSTOMER_COUNT]
FROM [BFM].[dbo].[CUSTOMER_DUPLICATES] AS [s1]
GROUP BY
[s1].[CUSTOMER_ID]
HAVING COUNT(DISTINCT [s1].[DUPLICATE_CUSTOMER_ID]) > 0
;
The loader STG_ST_dataflow_aggregation_Loader fills the table from this view and sets BG_LoadTimestamp to the load timestamp of the load control.
Release differences
Project Settings shows the Generator Version of your project.
- Generator 2.2: the project properties Persist Validity and Create Result Views; the model object property Increment Management Type on Stage.
Related articles
- Previous:
- Microsoft SQL Server: Target environment
- Next: Generate artifacts, Replace the placeholders in the artifacts
- Microsoft SQL Server: Artifacts, Deployment, Load data - Native load control, Load data - Apache Airflow load control
- Reference: Artifact Output Mode (Project), Deployment Options (Project), LoadControl Options (Project)
- Microsoft SQL Server: Placeholder values
- See also: Available Generator Configurations, Understand the Generator Configuration, Source systems per generator configuration, Oracle Stage
- Microsoft SQL Server: Stage Files, Stage OpenQuery, Data Store, Data Vault, Dimensional