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)
 Adding a constraint to a view

Author  Topic 

bmahony993
Yak Posting Veteran

58 Posts

Posted - 2008-04-02 : 12:22:14
I have created a SQL view of several tables, and need to add either a primary key or a constraint to this view. I need it for some full text indexing that will be performed on the view. How do I do it?

Thanks in advance :)

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-04-02 : 12:27:37
Constraints or Primary keys should be placed on underlying tables and not on view.

What is your requirement?

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-02 : 12:29:08
Just as you add it to a table. A view is just like a virtual table.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2008-04-02 : 13:00:58
Maybe if you post the DDL?

In any case it sounds like a non-updateable view, so what's the point

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

bmahony993
Yak Posting Veteran

58 Posts

Posted - 2008-04-02 : 13:44:11
The view that I am creating is used in a PHP page, and the data needs to be searchable. So, when defining the full text index on the view, I get an error saying there a unique column must be defined on this table/view.
Go to Top of Page
   

- Advertisement -