Re: Using DTS to automatically increment the primary key of the table

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Allan Mitchell (allan_at_no-spam.sqldts.com)
Date: 06/14/04


Date: Mon, 14 Jun 2004 13:42:35 +0100

Have a look at this article: It will help you get around some of the issues
you may encounter.

Problems With IDENTITY() and the DataPump task.
(http://www.sqldts.com/default.aspx?293)

-- 
----------------------------
Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
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
"Claire" <Claire@discussions.microsoft.com> wrote in message
news:62B77064-0B31-421B-AA04-5B7510D031C1@microsoft.com...
> I am totally new to SQL Server so apologies if this seems a silly
question. I am trying to schedule a daily import from a csv file into an
application that runs on SQL server. I can create a DTS package to do this
but the main problem is the primary key of the table is a surrogate key that
automatically increments. I cannot import a csv file without supplying a
memberID(primary key). I can supply a memberID in the base csv file if I
know the next number but this is not always possible as multiple sources can
insert a new row into the table. If I use SQL to insert a new row into the
SQL Server db (by using SQL Query Analyzer) the database will automatically
increment a memberID and the value does not need to be supplied. DTS seems
to be the easiest way to schedule a daily import but I cannot seem to get
around the auto incrementing primary key issue. All feedback is welcome &
sorry for being the annoying novice!


Relevant Pages

  • Re: Clustered Index question
    ... Columnist, SQL Server Professional ... If I keep the primary key, ... >select packet_time,packet_data from packet where ... >have the clustered index (either on PACKET_TIME or on ...
    (microsoft.public.sqlserver.programming)
  • A pk is *both* a physical and a logical object.
    ... Primary key is a logical constraint. ... but SQL Server does not allow you to create a unique or primary ... constraints) by indexing is purely *platform dependent*. ... PKs are part of the ANSI SQL standard *for db implementations*. ...
    (comp.databases.theory)
  • Re: Re-Seed in SQL Server
    ... Add a new field to the table that holds the Primary Key. ... or something like that and make it an Autonumber field and a Primary Key. ... If the table is already on the SQL Server you could try the below. ... that your Autonumber field in the Access Database has gotten corrupted. ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Table Design Advice
    ... I will be creating db in SQL server though. ... MaterialCost (Currency) ... CONSTRAINT pk_products PRIMARY KEY, ...
    (microsoft.public.sqlserver.setup)
  • Re: Primary key error
    ... I read the data from the sql server with a basic SELECT command. ... backup for each row where the column YPCODE has the value of the read data ... For the tables where YPcode is the primary key, this is not a problem, but I ... Cannot insert duplicate key in object 'dbo.OverallStatus'. ...
    (microsoft.public.sqlserver.server)