I wanted to create unique clustered index in view by name.
This is how I created the view
create view vWTotalsalesbyProduct
with schemabinding
as
select
Name,
Sum(Isnull(Unitprice * QuantitySold, 0)) as TotalSales,
COUNT_BIG(*) as Totaltransation
from
dbo.product P
join
dbo.tblproductcount C on P.productID = C.productID
group by
Name
and this is how I created unique clustered index
create unique clustered index UIX_vWTotalsalesbyProductName
on vWTotalsalesbyProduct(Name)
But I get an error
Column 'Name' in table 'vWTotalsalesbyProduct' is of a type that is invalid for use as a key column in an index.
Help me solve it


Namecolumn in the base table?