Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 A unique column must be defined on this table/view

Author  Topic 

webeye
Starting Member

1 Post

Posted - 2008-09-06 : 18:19:37
Hi,

I am trying to create a full text index on a view and getting following error 'A unique column must be defined on this table/view'.

My tables are..

http://www.postimage.org/image.php?v=aV11TD6r

And this is how i am creating view



CREATE VIEW [dbo].[wjt_ProductSearch]
AS
SELECT dbo.wjt_Products.ProductID, dbo.wjt_Products.AddedDate, dbo.wjt_Products.AddedBy, dbo.wjt_Products.DepartmentID, dbo.wjt_Products.Title,
dbo.wjt_Products.Description, dbo.wjt_Products.SKU, dbo.wjt_Products.UnitPrice, dbo.wjt_Products.DiscountPercentage,
dbo.wjt_Products.UnitsInStock, dbo.wjt_Products.SmallImageUrl, dbo.wjt_Products.FullImageUrl, dbo.wjt_Products.Votes, dbo.wjt_Products.TotalRating,
dbo.wjt_Departments.Title AS DepartmentTitle
FROM dbo.wjt_Products INNER JOIN
dbo.wjt_Departments ON dbo.wjt_Products.DepartmentID = dbo.wjt_Departments.DepartmentID


I do not have much knowledge about T-SQL. I am unable to figure out where is the problem. Help will be really appreciated.

Thanks.


SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-09-26 : 04:34:42
Are you trying to incorporate FULL TEXT or trying to index a view?



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-26 : 04:40:37
create a primary key or unique index for the column ProductID in your view and then retry.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-09-26 : 04:43:27
Looking at the schema seems that ProductID already is primary key.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-26 : 04:53:20
yeah...it seems so. then what else could be reason for the error?
Go to Top of Page
   

- Advertisement -