Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

How can I update several (not all) fields in table A from table B for replication?
I am trying to update the contents of table A (I'll use
Northwind..Products as an example) with the data from any changed
fields in Table B (which is a copy of Northwind..Products, but with
some updated values).  Table_A is replicated, so I would rather not
update every field, but just the fields where the values are different.


I could probably due it using dynamic SQL, but for many obvious reasons
I'd prefer not to.  And the reason for Table_B is replication - when we
get a "comprehensive" file we delete and start anew (and yes, there's a
reason for this as well), rather than just update the original.

The only way I've thought of is to do one for each field, something
like:

update products
set productname = products2.productname
from products, products
where products.id = products2.id and products.productname <>
products2.productname

update products
set supplierid = products2.supplerid
[...]

Any help greatly appreciated.  I considered trying some kind of CASE
clause that would set it to its own value (set productname =
products.productname), but that would (?) be considered a change and
would be replicated.


Report this thread to moderator Post Follow-up to this message
Old Post
M Bourgon
01-20-06 01:24 AM


Sponsored Links





Last Thread Next Thread
Post New Thread

Microsoft SQL Server forum archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 04:07 AM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006