Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Regular Coder
    Join Date
    May 2009
    Location
    Moore, OK
    Posts
    282
    Thanks
    11
    Thanked 41 Times in 41 Posts

    MsSQL INDEXing a column

    Can someone please tell me the MsSQL equivalent of this MySQL statement:
    Code:
    CREATE TABLE `test` (
      `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
      `name` VARCHAR(5),
      `foreign_key` INT UNSIGNED NOT NULL DEFAULT '0',
      UNIQUE INDEX (`name`),
      INDEX (`foreign_key`)
    );
    I'm having a problem with the INDEX part. Here is what I have:
    Code:
    CREATE TABLE test (
      id INT NOT NULL IDENTITY PRIMARY KEY,
      name VARCHAR(5),
      foreign_key INT NOT NULL DEFAULT '0',
      UNIQUE (name),
      INDEX (foreign_key)
    );
    Thanks.
    Last edited by Coyote6; 12-10-2009 at 12:26 AM. Reason: Accidently left UNSIGNED in MsSQL statement


 

Tags for this Thread

Posting Permissions

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