SQL Server Performance

Add Constraint

Discussion in 'General Developer Questions' started by Madhivanan, Mar 4, 2005.

  1. Madhivanan Moderator


    Is there a way to add a primary key constraint to the existing column thru query?

    Madhivanan
  2. FrankKalis Moderator

    <pre id="code"><font face="courier" size="2" id="code"><br />alter table &lt;your table &gt;<br /> add constraint &lt; your name &gt; primary key (&lt; your column &gt<img src='/community/emoticons/emotion-5.gif' alt=';)' /><br /></font id="code"></pre id="code"><br />Make sure this column is defined as NOT NULL<br /><br />--<br />Frank<br /<a target="_blank" href=http://www.insidesql.de>http://www.insidesql.de</a><br />
  3. Madhivanan Moderator


    Thanks Frank. It works well

    Madhivanan
  4. amitm79 New Member

    Hi Madhivanan,
    I believe your query was too easy to be found in BOL also. Will recommend you to do a quick scan in BOL before you post.

    Regards,
    Amit
  5. Madhivanan Moderator

    quote:Originally posted by amitm79

    Hi Madhivanan,
    I believe your query was too easy to be found in BOL also. Will recommend you to do a quick scan in BOL before you post.

    Regards,
    Amit

    Amit
    I was little confused when I saw in BOL and thats why I posed here

    Madhivanan

Share This Page