- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Alternative to Identity columns in Warehouse
Hello,
What is an alternative way to generate an identity column when using a Warehouse?
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Trystan you can use ROW_NUMBER() to mannually generate them via sql queries and add the data in your table
Ps: If my response helped, kindly select it as the solution. Your kudos are greatly appreciated!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just an interesting note, as of now, you can create temporary tables with an identity column. Not sure when that started.
DROP TABLE IF EXISTS #tempTable
CREATE TABLE #tempTable (a INT IDENTITY (1, 1), b int)
INSERT INTO #tempTable (b) VALUES (1)
INSERT INTO #tempTable (b) VALUES (1)
INSERT INTO #tempTable (b) VALUES (1)
INSERT INTO #tempTable (b) VALUES (2), (2), (2), (2)
INSERT INTO #tempTable
SELECT 3 FROM #tempTable
SELECT * FROM #tempTable
--------------------
But, as of now, you cannot use a permanent table in the same query as a temporary table, so you cannot additionally try to insert this temporary table into a permanent table.
Does not work:
DROP TABLE IF EXISTS permanentTable
CREATE TABLE permanentTable (a INT, b INT)
INSERT INTO dbo.permanentTable (a, b)
SELECT a, b FROM #tempTable
Error: Msg 15816, Level 16, State 3, Line 17
The query references an object that is not supported in distributed processing mode.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Adding a note from the future:
There is now a full example of this workaround on Microsoft Learn / Documentation:
https://learn.microsoft.com/en-us/fabric/data-warehouse/generate-unique-identifiers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Trystan you can use ROW_NUMBER() to mannually generate them via sql queries and add the data in your table
Ps: If my response helped, kindly select it as the solution. Your kudos are greatly appreciated!

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Fabric Monthly Update - February 2025
Check out the February 2025 Fabric update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
09-25-2024 06:10 AM | |||
01-15-2025 02:24 AM | |||
12-13-2024 06:30 AM | |||
05-03-2024 03:26 AM | |||
09-19-2024 06:17 AM |
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
5 | |
3 | |
2 | |
2 | |
2 |