Go Back   CodingForums.com > :: Server side development > MySQL > Other Databases

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-10-2009, 12:24 AM   PM User | #1
Coyote6
Regular Coder

 
Join Date: May 2009
Location: Moore, OK
Posts: 277
Thanks: 10
Thanked 41 Times in 41 Posts
Coyote6 is an unknown quantity at this point
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
Coyote6 is offline   Reply With Quote
Reply

Bookmarks

Tags
index, key, mssql, mysql, syntax

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:33 PM.


Advertisement
Log in to turn off these ads.