dbTalk Databases Forums  

Add Column Make PK

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


Discuss Add Column Make PK in the microsoft.public.sqlserver.dts forum.



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

Default Add Column Make PK - 01-05-2004 , 06:30 AM






I have a table that I empty then re-import with a scheduled DTS package.
What is the best way to designate a column as a primary key within the
package details. Would it be possible to create a new column and make it
a PK within the package? Help appreciated. Thanks.

Frank


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

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

Default Re: Add Column Make PK - 01-05-2004 , 07:20 AM






Yes. Anything you can do like that in TSQL you can do in a DTS Package.

If you export the table you can then have an ExecuteSQL task that makes a
column the Primary Key afterwards.

If you are only emptying the table then why would you drop this constraint
each time ?
--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



"Frank Py" <fpy (AT) proactnet (DOT) com> wrote

Quote:
I have a table that I empty then re-import with a scheduled DTS package.
What is the best way to designate a column as a primary key within the
package details. Would it be possible to create a new column and make it
a PK within the package? Help appreciated. Thanks.

Frank


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Reply With Quote
  #3  
Old   
Frank Py
 
Posts: n/a

Default Re: Add Column Make PK - 01-05-2004 , 11:02 AM



Thanks, I have been working with this. How would I create a primary key
on a column or a composit primary key on 2 columns if the table and data
is already created by DTS. I know you mentioned SQL task, but I was
having trouble finding a syntax example that didn't have CREATE TABLE
with it. Is this possible? Thanks.
Frank



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Reply With Quote
  #4  
Old   
Frank Py
 
Posts: n/a

Default Re: Add Column Make PK - 01-05-2004 , 12:02 PM



Woops! Sorry, I was making this too hard. I just created the keys in
Enterprise Manager and it works fine each time the data is reloaded with
DTS. Thanks again.
Frank



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

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.