Results 1 to 3 of 3

Thread: Simple questions

  1. #1
    Join Date
    Apr 2003
    Posts
    1

    Simple questions

    I have some simple questions but cant seem to find the ansewer to them.

    One: How do you change the date type or the datatype Length once the column is already made? With just sql querys.

    Two: How do you set a primary key so every record has its own unique number?

    Kesper

  2. #2
    Join Date
    Mar 2003
    Location
    Jacksonville, Florida
    Posts
    52
    Someone correct me if needed...

    1)

    ALTER TABLE <table>
    ALTER COLUMN <field> <datatype> <additional params>

  3. #3
    Join Date
    Mar 2003
    Location
    Woking, UK
    Posts
    152
    2)
    If exist colum with you want make Primary Key of the table ...

    ALTER TABLE <table>
    ADD [CONSTRAINT <constraint name>]
    PRIMARY KEY [CLUSTERED | NONCLUSTERED ] (<colname> [ASC | DESC][,<colname>...])

    EXAMPLE:
    ALTER TABLE aaa ADD CONSTRAINT aaa_PK PRIMARY KEY (col1)

    -----
    If not , first you must add column with unique values and than make ALTER TABLE...
    You Have To Be Happy With What You Have To Be Happy With (KC)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •