DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Adding Primary Keys & Losing Triggers??

  1. #1
    Beginner-Brad Guest

    Adding Primary Keys & Losing Triggers??


    Dear Friends,

    >When you alter your table structure by adding/removing columns, >the table
    >is actually re-created and the new id is mapped for >all the dependencies.



    The problem I am having is when I add an additional Primary Key to an existing
    column name..NOT a new column,,,I am not changing the structure of my table
    ,,rather I am just adding a Primary Key(an additional Primary Key)..when
    I do this ...then I try to exit by saving this new information, I receive
    a Save Attention message telling me that "The following tables will be saved
    to your database,,do you wish to continue?" If I choose YES ,,then it saves
    the Table with the newly added Primary Key and consequently wipes/deletes
    my Triggers,,HOWEVER , if I choose to not save, it just keeps the Table as
    is and does not add the new PK's to the table.

    I tried what someone had mentioned by getting out of EM then returning although
    I think that we are NOT talking about the same problem,,,I am changing the
    structure of the Primary keys in my table and by doing so, I am subsequently
    wiping/deleting the triggers that I have wriiten of rthat Table..

    Any ideas ...please help me ...more detail?

    Thanks in advance,
    Brad Isaacs
    Junior VB Developer / SQL Server 7.0 databases



  2. #2
    Neil Pike Guest

    Re: Adding Primary Keys & Losing Triggers??

    Brad - try using the ALTER TABLE/ALTER COLUMN/CREATE PRIMARY KEY type commands
    - I don't use SQL EM much so what it's trying to do under the covers I don't
    know....

    Neil Pike MVP/MCSE. Protech Computing Ltd
    Reply here - no email
    SQL FAQ (484 entries) see
    http://forumsb.compuserve.com/gvforu...?SRV=MSDevApps
    (faqxxx.zip in lib 7)
    or http://www.ntfaq.com/Articles/Index....partmentID=800
    or www.sqlserverfaq.com
    or www.mssqlserver.com/faq


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center