I have a model that was generated for MySQL 5 but now I need to create these tables on a SQL Server installation.
It's been years since I mucked with SQL server and I want to make sure I can convert this script to be compatible.
I don't really know what to look for TBQH, so without further ado, here's my MySQL DDL
CREATE SCHEMA IF NOT EXISTS `bof_survey` DEFAULT CHARACTER SET utf8 COLLATE default collation ;
USE `bof_survey`;
-- -----------------------------------------------------
-- Table `bof_survey`.`question`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `bof_survey`.`question` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`text` VARCHAR(255) NOT NULL ,
PRIMARY KEY (`id`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `bof_survey`.`category`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `bof_survey`.`category` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(45) NOT NULL ,
`adverb` VARCHAR(45) NOT NULL ,
PRIMARY KEY (`id`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `bof_survey`.`answer`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `bof_survey`.`answer` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`question_id` INT UNSIGNED NULL ,
`category_id` INT UNSIGNED NULL ,
`text` VARCHAR(60) NULL ,
PRIMARY KEY (`id`) ,
INDEX `fk_answer_question` (`question_id` ASC) ,
INDEX `fk_answer_category1` (`category_id` ASC) ,
CONSTRAINT `fk_answer_question`
FOREIGN KEY (`question_id` )
REFERENCES `bof_survey`.`question` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_answer_category1`
FOREIGN KEY (`category_id` )
REFERENCES `bof_survey`.`category` (`id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;