473,569 Members | 2,765 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DTS for insert/update

I'm new to DTS. I read some docs before adventuring into this matter.
I still haven't found in all the docs I read if there is some "built-in" DTS
task or function or wathever, to do a mixed "insert/update" import from a
source, giving a unique field as primary key.
I'll try to be more specific. The problem I would like to solve is this:
I have a source file (csv) but it could be any source. I must check this
file for all the records and compare them with the ones in the db (giving a
unique field as a way of checking), so that all the records that already
exist, are UPDATED, and the others are INSERTED.
I guess this is one most common task to accomplish, when you have a local
based application that you regularly update and then you want to export the
data to another "slave" application without using replication. But even if
this sounds to me like a common task, I found no "buil-in" function for that
in DTS. I read something about "lookups" but it don't know if it's related
somehow.. it wasn't very clean.
Thanks in advance for suggestions.

--
:: Massimiliano Mattei
:: Project Leader
:: E.xtranet V.irtual A.pplication
:: www.evagroup.net :: www.commy.biz
Jul 20 '05 #1
3 8283
Massimiliano,
Yes, that is a very common task. The best way to handle this is to
import directly into a temp table and then run a procedure to
check/insert/update your data into a production table.
If you need a specific example to follow, we have one on our website at
www.TechnicalVideos.net. $19.99 buys all of our videos for 3 months. Our
DTS videos will have an expert show you step by step how to do this.

Hope that helps,
Best Regards,
Chuck Conover
www.TechnicalVideos.net
"xMANIGHTx" <ma*****@ufolog ia.net> wrote in message
news:c2******** **@lacerta.tisc alinet.it...
I'm new to DTS. I read some docs before adventuring into this matter.
I still haven't found in all the docs I read if there is some "built-in" DTS task or function or wathever, to do a mixed "insert/update" import from a
source, giving a unique field as primary key.
I'll try to be more specific. The problem I would like to solve is this:
I have a source file (csv) but it could be any source. I must check this
file for all the records and compare them with the ones in the db (giving a unique field as a way of checking), so that all the records that already
exist, are UPDATED, and the others are INSERTED.
I guess this is one most common task to accomplish, when you have a local
based application that you regularly update and then you want to export the data to another "slave" application without using replication. But even if
this sounds to me like a common task, I found no "buil-in" function for that in DTS. I read something about "lookups" but it don't know if it's related
somehow.. it wasn't very clean.
Thanks in advance for suggestions.

--
:: Massimiliano Mattei
:: Project Leader
:: E.xtranet V.irtual A.pplication
:: www.evagroup.net :: www.commy.biz

Jul 20 '05 #2
Thanks Chuck!
Your videos are really a good idea!! I checked the demo one and they are
kool... maybe I'm going to subscribe, even if I'm italian.
I must say that the language is well understandable even if a bit "American"
:)
You say that the best pratice is to import first all teh data in a temp
table (maybe to use the bulk inserta advantages) but what if the records are
really too much? Say I have to import 100.000 records or more.. Would you
use a #temp_table, just a "memory" table or a real table?
I don't know if SQL Server writes down #temp_tables just like it does with
real ones, otherwise the server would have to mantain 100.000 records in
memory...
Wich type of table would you suggest? Maybe SQL Server has memory
optimization routines wich write to disk data of #tables not to hold them
only in the RAM?
Do you think this is the best method? DTS is for data trasformation so it's
ODD it doesn't have something that lets you
import/check/transform/insert-update data without writing a specific
procedure for that.

--
:: Massimiliano Mattei
:: Project Leader
:: E.xtranet V.irtual A.pplication
:: www.evagroup.net :: www.commy.biz
Jul 20 '05 #3
Massimiliano,
Sorry. I know we are too American. We really need to get out more.
My explanation was not very good. By "temp" table, I mean a table that
is not a production table. We can call this a "working" table. So, I would
use a real table to temporarily store the data for your bulk upload, not an
actual temp table that gets stored in memory. I would do it this way even
if you only have a few records. Then, my DTS package would look like this:

- delete all records from the working table
- upload my data file to my working table
- run stored procedure to check/insert/update data row by row from the
working table to my production table

This way, we can execute each step one at a time, and browse the working
table to make sure the data went into each field correctly.
Hope this helps,
Chuck Conover
www.TechnicalVideos.net

"xMANIGHTx" <ma*****@ufolog ia.net> wrote in message
news:c2******** **@lacerta.tisc alinet.it...
Thanks Chuck!
Your videos are really a good idea!! I checked the demo one and they are
kool... maybe I'm going to subscribe, even if I'm italian.
I must say that the language is well understandable even if a bit "American" :)
You say that the best pratice is to import first all teh data in a temp
table (maybe to use the bulk inserta advantages) but what if the records are really too much? Say I have to import 100.000 records or more.. Would you
use a #temp_table, just a "memory" table or a real table?
I don't know if SQL Server writes down #temp_tables just like it does with
real ones, otherwise the server would have to mantain 100.000 records in
memory...
Wich type of table would you suggest? Maybe SQL Server has memory
optimization routines wich write to disk data of #tables not to hold them
only in the RAM?
Do you think this is the best method? DTS is for data trasformation so it's ODD it doesn't have something that lets you
import/check/transform/insert-update data without writing a specific
procedure for that.

--
:: Massimiliano Mattei
:: Project Leader
:: E.xtranet V.irtual A.pplication
:: www.evagroup.net :: www.commy.biz

Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
15397
by: shottarum | last post by:
I currently have 2 tables as follows: CREATE TABLE . ( mhan8 int, mhac02 varchar(5), mhmot varchar(5), mhupmj int )
14
4276
by: serge | last post by:
I have a scenario where two tables are in a One-to-Many relationship and I need to move the data from the Many table to the One table so that it becomes a One-to-One relationship. I need to salvage the records from the many table and without going into detail, one of the reasons I can't do the opposite as there are records in the ONE table...
16
16984
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums must be UPDATED, if not, they must be INSERTED. Logically then, I would like to SELECT * FROM <TABLE> WHERE ....<Values entered here>, and then...
16
3856
by: robert | last post by:
been ruminating on the question (mostly in a 390/v7 context) of whether, and if so when, a row update becomes an insert/delete. i assume that there is a threshold on the number of columns of the table, or perhaps bytes, being updated where the engine just decides, screw it, i'll just make a new one. surfed this group and google, but...
3
3434
by: Shapper | last post by:
Hello, I have created 3 functions to insert, update and delete an Access database record. The Insert and the Delete code are working fine. The update is not. I checked and my database has all the necessary records in it when testing it. I get the error "No value given for one or more required parameters." when I try to update the...
20
18319
by: Mark Harrison | last post by:
So I have some data that I want to put into a table. If the row already exists (as defined by the primary key), I would like to update the row. Otherwise, I would like to insert the row. I've been doing something like delete from foo where name = 'xx'; insert into foo values('xx',1,2,...);
3
7360
by: V T | last post by:
Hello all, SQL Server 2000 documentation http://www.microsoft.com/technet/prodtechnol/sql/2000/reskit/part10/c3761.mspx states that if view is using "NOT NULL" columns of a base table, then insert/update performed on a view must provide dummy values for those columns, and code of the trigger should ignore them. But I cannot reproduce...
1
6193
by: abhi81 | last post by:
Hello All, I have a table on which I have created a insert,Update and a Delete trigger. All these triggers write a entry to another audit table with the unique key for each table and the timestamp. Insert and Update trigger work fine when i have only one of them defined. However when I have all the 3 triggers in place and when i try to fire...
4
4846
by: =?Utf-8?B?UmljaA==?= | last post by:
On a form - I have a datagridview which is docked to the entire form. The datagridview allows users to Delete and/or Add Rows. On the Form_Load event I Fill the datagridview source table with a sql DataAdapter (da) da.SelectCommand.CommandText = "Select * from Servertbl1" da.Fill(ds, "tbl1") so far, so good. If I add a row to the...
0
2276
by: magnolia | last post by:
i created a trigger that will record the changes made to a table .everything works fine except the insert query.whenerever i try to insert a record it fires insert and update triger at the same time which means i hav 2 record for every insert operation. any help appreciated. thank u herez teh code i tried. ALTER TRIGGER...
0
7697
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
1
7672
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7968
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6283
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.