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
 General SQL Server Forums
 New to SQL Server Programming
 Changing Index Option

Author  Topic 

Dkory22
Starting Member

3 Posts

Posted - 2007-05-30 : 23:08:43
We have a database at work that holds URL's to documents that people must read and sign off on. The problem is when a duplicate URL is entered because the document has been updated the system will not add it to the database because it is a duplicate key. I can tell from looking through the sql files that it is not a primary key so from what I've read I need to turn on IGNORE_DUP_KEY for the index's options. Is there a way I can just open a window and turn this on or do I have to somehow run a script to set it up? If so, could someone explain how to run the script? Thanks

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-05-30 : 23:23:07
Is there unique index on the column? When IGNORE_DUP_KEY is set to OFF (the default), the SQL Server 2005 Database Engine rejects all rows in the statement when one or more rows contain duplicate key values. When set to ON, only the rows that contain duplicate key values are rejected; the nonduplicate key values are added.

There's no way to insert dup rows if the column is pkey or has unique index/constraint on it.
Go to Top of Page

LoztInSpace
Aged Yak Warrior

940 Posts

Posted - 2007-05-31 : 00:34:45
Sounds like you've got the wrong end of the stick. You should not be doing anything like this. Address your business requirements and change the app & database accordingly.
Go to Top of Page

Dkory22
Starting Member

3 Posts

Posted - 2007-05-31 : 01:00:18
So there is no option to change on the index that will simply allow this to be entered? I don't think it is set as unique and I know it is not the primary key. I do think I could change the app code if necessary but it seems like I should be able to enter identical URL's. Is there possibly a script I could run that would make sure it is not unique?
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-05-31 : 09:55:42
Does the table have unoque index/constraints on other columns?
Go to Top of Page

Dkory22
Starting Member

3 Posts

Posted - 2007-05-31 : 12:33:48
I don't think it does, but how can I check for sure?
Go to Top of Page
   

- Advertisement -