dbTalk Databases Forums  

Updating data in tables

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Updating data in tables in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Shane
 
Posts: n/a

Default Updating data in tables - 02-10-2004 , 06:56 PM






I would like to update some data within existing tables. I currently have data that is in tables but i would like to update some of the fields. I run dts and it populates a staging table. From there i would like to update the last table with the update data from the staging table. The existing data that exists in the last table might not have all the information that is held in the staging table. eg der date may have changed but it has not been updated in the last table
the table design and structure are exactly the same with the same column headings. How do i Update a table that only some of the data has changed. eg NSN number has changed



Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Updating data in tables - 02-11-2004 , 01:42 AM






OK there are a few ways to do this

1. After you move the data from Source to Working table destination you
issue a Blanket update to the real table updating it to the values in the
working table where the key values match (Identifying attributes). To
insert new rows you do the rows in working table that are not in Real table
and the deletes are rows in real table not in source working table. This
presumes you bring ALL the source over

Pros - Easy
Cons - You may be bringing over a lot of data and therefore this could be
intensive.

2. Through triggers identify rows thaat have had operations defined on them
and log those rows to a seperate table. Use this sperate table as the
source to move to your staging table.

Pros - lighter possible load
Cons - triggers may not be feasible for you and you need to maintain another
table.

3. Have an attribute on each row that identifies LastModTime. This way you
can through triggers update it when an operation happens
You then use a qualified SELECT as your source where the LastModTime is
within your timeframe

Pros - Lighter possible load
Cons - Triggers - Another row on table which could cause problems if you use
SELECT * in some of your statements

Just a few suggestions for you.

--

----------------------------

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Shane" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
I would like to update some data within existing tables. I currently have
data that is in tables but i would like to update some of the fields. I run
dts and it populates a staging table. From there i would like to update the
last table with the update data from the staging table. The existing data
that exists in the last table might not have all the information that is
held in the staging table. eg der date may have changed but it has not been
updated in the last table.
Quote:
the table design and structure are exactly the same with the same column
headings. How do i Update a table that only some of the data has changed. eg
NSN number has changed.
Quote:




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.