Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Table Question

Status
Not open for further replies.

Jhibo

MIS
Sep 19, 2001
6
US
Within our database, which runs on SQL, we have multiple tables one called Contact2. Seems in our Contact2 SQL table we have the same company with two rows. One row, with the old data and the other with the new data with the same ACCOUNTNO (which is unique to the record) on each row. Is this normal or do we have issues?
We found this problem by noticing that our database is pulling one row and our crystal reports is pulling another on certain records.

Thanks for your help
 
It isn't normal to have the same unique key on two rows. Your explanation suggests that the ACCOUNTNO is not defined as unique in the SQL Server table. Does the table have a primary key defined? Is the key defined on the ACCOUNTNO column, another coulmn or perhaps multiple columns? If no primary key is defined, does the table have a unique index? Primary keys, whichj are unique by definitrion, or unique constraints are required to guarantee uniqueness.

You should delete one of the duplicate rows. There are likely more duplicates for other ACCOUNTNOs. After deleting duplicates, add a unique constraint on the ACCOUNTNO column.

If you want to get the best answer for your question read faq183-874 and faq183-3179.
Terry L. Broadbent - DBA
SQL Server Page:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top