Results 1 to 3 of 3

Thread: [RESOLVED] SQL Server 2005: Create view with unique numeric column

  1. #1

    Thread Starter
    Fanatic Member aconybeare's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    772

    Resolved [RESOLVED] SQL Server 2005: Create view with unique numeric column

    Hi,

    I need to set up full text searching on a table with a non-numeric composite primary key. When I try to do this I get an error saying it requires a unique index, despite the fact that the composite PK is unique and has an index on it

    The idea is to create a view of this table with a new key field I've tried using the NewID() function but when I try to create the index get an error saying it contains text,ntext,xml etc.

    Does anyone know how to create a view with a unique numeric key? Or any other ideas on tackling this little snag.

    I guess an alternative is to create a new numerical primary key. This might be possible since referential integrity isn't enforced in the db, trick would be populating the existing table data.

    Regards Allan

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: SQL Server 2005: Create view with unique numeric column

    From BOL
    The KEY INDEX must be a unique, single-key, non-nullable column. Select the smallest unique key index for the full-text unique key. For best performance, a CLUSTERED index is recommended.
    The column does not have to be the PK.

    Add an Identity column to the table. SQL Server will populate the new column automatically.

  3. #3

    Thread Starter
    Fanatic Member aconybeare's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    772

    Re: SQL Server 2005: Create view with unique numeric column

    Perfect thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width