I want to create a SQL Server table materialized view where I want to add an extra column named ID which is auto increment.
Is that possible?
No, that's not possible. The restrictions on indexed views prevent this.
The ID would not be stable anyway. It would change in unexpected ways when the underlying data changes. The view is not a persistent table. It reflects what the view definition says at all times.
Use something else as the key of the indexed view. Usually, there is a suitable combination of columns from the underlying tables.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With