|
|
Subject:
SQL Server versus MS Access
Category: Computers > Programming Asked by: pittsburghsteelers-ga List Price: $2.00 |
Posted:
21 Jul 2004 11:50 PDT
Expires: 20 Aug 2004 11:50 PDT Question ID: 377228 |
is there a way in SQL Server 2000 that I can only append records where the information that I'm trying to append doesn't violate primary key restrictions? In MS Access, when I run the append query, it will throw up an error message saying that it can't append X number of records due to violations but will allow me to append whatever didn't have the violation...in SQL Server, it stops the entire T-SQL statement, not adding any records whatsoever. for example, let's say that I have a table that shows FirstNames as well as other names that is also used instead of this name: FieldNames: Name:Alias Bill:Billy Bill:Will Bill:William The combined field values of [Name] & [Alias] are the primary key, as I don't want duplicates of the combination. So if I want to add the following field values: Bill:Willy Bill:Will I want to be able to add the first set (not already listed) and to simply ignore the attempt of adding the second set (already in the table). | |
| |
| |
|
|
There is no answer at this time. |
|
Subject:
Re: SQL Server versus MS Access
From: scubapup-ga on 21 Jul 2004 20:34 PDT |
are you doing a record by record insert or are you doing a bulk insert select thingie? |
Subject:
Re: SQL Server versus MS Access
From: pittsburghsteelers-ga on 21 Jul 2004 21:24 PDT |
I'm attempting to do this insert as an automated "bulk" task, not record-by-record. Thanks. |
Subject:
Re: SQL Server versus MS Access
From: mike_sysadmin-ga on 02 Aug 2004 18:14 PDT |
Hi pittsburghsteelers, Simple answer: row by row insert. Microsoft SQL Server handles transactions in a very different way MS Access does. Every transaction has to satisfy the Object Management Group Transaction Service specifications. A transaction should be atomic, with consisted results, cpu isolated and durable. If a constraint is violated, SQL Server reverses the whole transaction and no rows are inserted/updated. These operations are labeled "atomic", because you cannot split them, either the whole bulk transaction succedes with no errors, or the whole transaction fails and its reversed. This is done in a way to protect the integrity and consistency of the data. Imagine that you are about to receive money from an ATM when the power grid goes down. The money deduction from your account was completed with the bank, but then the whole transaction is reversed because it failed at the last moment. |
Subject:
Re: SQL Server versus MS Access
From: patsky-ga on 09 Aug 2004 14:05 PDT |
Import the data into a temp table. Create a query that joins the "new" table to the existing table with a left join. Make the selection criteria - Where YourExistingTable.PrimaryKey Is Null. This query will return all rows from the "new" table that do not have key matches in the existing table. Then change this into an append query. |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |