How to Create a Warehouse in Microsoft Fabric with T-SQL
A Warehouse in Microsoft Fabric is a relational data warehouse that speaks T-SQL, designed to store curated data and feed Power BI reports. Creating one and filling it with your first tables takes only a few minutes and needs no installation — everything runs in the browser. Below you will see how to create a Warehouse in Microsoft Fabric, from scratch to your first query with results.
Prerequisites
- An account with access to Microsoft Fabric and an active capacity (trial or paid).
- A Fabric workspace where you have permission to create items (Member or Admin role).
- Basic SQL knowledge, such as SELECT and INSERT — nothing advanced.
Step 1: Create the Warehouse
In the Fabric portal, open your workspace and click + New item. In the item gallery, find and choose Warehouse, give it a clear name (for example VendasDW) and confirm. Within a few seconds the Warehouse is ready and the editor opens, with the table Explorer on the left. Unlike a traditional SQL server, there is nothing to configure or provision: the Fabric capacity handles the infrastructure for you and the data is stored in OneLake.
Step 2: Create a table with T-SQL
On the ribbon, click New SQL query to open a blank window. Let's create a simple table to record sales. Paste the code below and click Run:
CREATE TABLE dbo.Vendas (
VendaID INT,
Produto VARCHAR(50),
Regiao VARCHAR(30),
Quantidade INT,
Valor DECIMAL(10,2),
DataVenda DATE
);
We used only data types supported by the Warehouse: INT, VARCHAR, DECIMAL and DATE. After running it, the Vendas table appears in the Explorer, inside the dbo schema.
Tip: the Fabric Warehouse accepts constraints such as PRIMARY KEY, but does not enforce them (they are NOT ENFORCED). Make sure your data is unique in your loading logic.
Step 3: Insert data
With the table ready, let's add a few sample rows. Open a new query (or clear the previous one) and run:
INSERT INTO dbo.Vendas (VendaID, Produto, Regiao, Quantidade, Valor, DataVenda)
VALUES
(1, 'Teclado', 'Norte', 10, 199.90, '2026-07-01'),
(2, 'Rato', 'Sul', 25, 99.75, '2026-07-02'),
(3, 'Monitor', 'Norte', 5, 749.50, '2026-07-03'),
(4, 'Teclado', 'Centro', 12, 239.88, '2026-07-04');
Each row represents a sale. The Warehouse accepts several rows in a single INSERT, which is much faster than inserting one at a time. To load large files (CSV or Parquet from OneLake) you would use the COPY INTO command instead, but for small data INSERT is perfectly fine.
Step 4: Query the data with T-SQL
Now the most useful part: asking questions of your data. Let's sum the amount sold per region and count how many sales there were, ordered from the highest to the lowest total:
SELECT
Regiao,
COUNT(*) AS NumVendas,
SUM(Valor) AS TotalVendido
FROM dbo.Vendas
GROUP BY Regiao
ORDER BY TotalVendido DESC;
The result shows each region with the number of sales and the total revenue. Just change the columns in the GROUP BY to group by product, by date, or by any other dimension. It is the same T-SQL you already know from SQL Server, with no surprises, and the editor even offers IntelliSense and syntax highlighting.
If you want to filter, for example only the sales from the North region, add a WHERE clause:
SELECT Produto, Quantidade, Valor
FROM dbo.Vendas
WHERE Regiao = 'Norte'
ORDER BY Valor DESC;
Verify the result
To confirm everything is fine, do two quick checks. First, in the Explorer on the left, expand Schemas > dbo > Tables and confirm the Vendas table appears with the right columns. Second, run a simple count:
SELECT COUNT(*) AS TotalLinhas FROM dbo.Vendas;
If it returns 4, the data was inserted correctly. Alternatively, select the table in the Explorer and open the Data preview tab to see the rows without writing a single line of SQL.
Conclusion
In four steps you created a Warehouse, designed a table, inserted data and ran your first analytical query — all with T-SQL and without leaving the browser. The natural next step is to connect this Warehouse to Power BI through the default semantic model and build a report on the Vendas table. Which business question would you like to answer next with your own data?