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.
Author |
Topic |
rookie_sql
Constraint Violating Yak Guru
443 Posts |
Posted - 2007-07-10 : 11:19:32
|
Hi i've a table where i add data to each day but i want to make sure i have no duplicates in this table so i need a way of running a update on the table so all the date gets group by how can i acheive this ? |
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-07-10 : 11:27:05
|
You can check before you insert. IF NOT EXISTS ( SELECT * FROM ... WHERe ...)BEGIN INSERT ...END What do you need to do with the duplicates? delete them? or move them to another table? You said "update" but didnt mention the details?Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-07-11 : 01:23:00
|
It seems you add data and then try to remove duplicates. Dont do that. As said, check the existance of data before addingMadhivananFailing to plan is Planning to fail |
 |
|
LoztInSpace
Aged Yak Warrior
940 Posts |
Posted - 2007-07-11 : 04:29:29
|
...or add a unique constraint on the appropriate columns. |
 |
|
|
|
|