Add Unique Index on Union View (SQL Server 2008)
I have a view which combines two tables using UNION ALL
.
Is it possible to 开发者_如何学JAVAcreate a unique index on the view?
No, you cannot create an indexed view if the view is using UNION, this was true in SQL 2000 and is still true in 2008, see also http://msdn.microsoft.com/en-us/library/dd171921(SQL.100).aspx
Indexed views cannot contain the UNION
operator: see here
精彩评论