A table has no primary key column, Need to write a trigger which should not allow any duplicate values.
asked Jan 18, 2010 at 05:54 AM in Default
What is the reason to not have a primary key? Do you really need a trigger?
If you need to prevent duplicates I would recommend you to have a primary key or unique (clustered?) index. Why? If you use a trigger to search for duplicates you will also need an index to get performance. If you don't use an index that match your condition you will end up with a slow table/index/heap scan.
answered Jan 18, 2010 at 06:21 AM
You could also use a unique constraint/unique index. http://msdn.microsoft.com/en-us/library/aa224827(SQL.80).aspx
answered Jan 18, 2010 at 06:16 AM