Hi,
I am new-ish to SQL server (2005) and I would like to do something that I did fairly regularly in Access but I can't seem to figure out in SQL - use a Primary Key (or index) to reject certain data being inserted into a table.
With Access, if I had 100 records and a few, say 20 would break the PK, I could run an append query (with warnings off) on the entire 100 and the 80 "valid" records would be inserted and the 20 bad records would be left behind. Nice and simple.
With SQL server however, the insert statement won't execute at all because of the constraints. Is there any way I can get SQL server to replicate Access functionality in this area? (Preferably without building a complex set of queries to filter the data myself, or iterating through each record)
Seeing it written down like that, it does look like bad DB practice and it is probably a dirty habit I picked up from cutting my teeth in Access... but if the functionality is there - why not use it?!
Cheers,
Tom
I am new-ish to SQL server (2005) and I would like to do something that I did fairly regularly in Access but I can't seem to figure out in SQL - use a Primary Key (or index) to reject certain data being inserted into a table.
With Access, if I had 100 records and a few, say 20 would break the PK, I could run an append query (with warnings off) on the entire 100 and the 80 "valid" records would be inserted and the 20 bad records would be left behind. Nice and simple.
With SQL server however, the insert statement won't execute at all because of the constraints. Is there any way I can get SQL server to replicate Access functionality in this area? (Preferably without building a complex set of queries to filter the data myself, or iterating through each record)
Seeing it written down like that, it does look like bad DB practice and it is probably a dirty habit I picked up from cutting my teeth in Access... but if the functionality is there - why not use it?!
Cheers,
Tom