Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 DTS - Excel Import

Author  Topic 

Nick
Posting Yak Master

155 Posts

Posted - 2002-12-18 : 14:59:48
Hello-

I'm rather new to using DTS. I have a simple Excel spreadsheet that I would like to import into my database. The spreadsheet has two columns (Point of Interest and Type). I would like to import these two fields into a database with the following tables:

CREATE TABLE [dbo].[tblPointsOfInterest] (
[poiID] [int] IDENTITY (10001, 1) NOT NULL ,
[poiTypeID] [int] NOT NULL ,
[poiDesc] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[tblPointsOfInterestTypes] (
[poiTypeID] [int] IDENTITY (10001, 1) NOT NULL ,
[poiTypeDesc] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO

I'm hoping that the DTS can do the following for the Type column. Check tblPointsOfInterestTypes to see if the type is already present. If it is, assign that to poiTypeID in tblPointsOfInterest. If not, create the new type and assign the new poiTypeID to new entry.

Is something like this possible. And if so can I see an example of how this would work?

Thanks-
Nick

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2002-12-18 : 17:02:16
You can import the data to stagging tables used to hold the data temporarily. Use a transform data task.

Then you can run T-SQL in an execute sql task to perform your update or insert statements.

You might also want to check out www.sqldts.com

Go to Top of Page
   

- Advertisement -