[dba-SQLServer] MySQL to SQL Server Data Type Equivalents

Robert Stewart rls at WeBeDb.com
Mon Sep 17 11:05:44 CDT 2012


The DDL should be:

CREATE TABLE Accounts (

account_id INT PRIMARY KEY IDENTITY(1,1),

account_name VARCHAR(20),

first_name VARCHAR(20),

last_name VARCHAR(20),

email VARCHAR(20),

password_hash CHAR(64),

portrait_image VARBINARY(MAX),

hourly_rate NUMERIC(9,2)

);

OR



account_id BIGINT PRIMARY KEY IDENTITY(1,1),

If you are expecting a real big database.

You need to put the seed and starting point in for the IDENTITY.

And, personally, I would convert hourly_rate to money data type.


At 10:49 AM 9/17/2012, you wrote:
Date: Mon, 10 Sep 2012 09:25:07 -0500
From: "Alan Lawhon" <lawhonac at hiwaay.net>
To: "'Discussion concerning MS SQL Server'"
         <dba-sqlserver at databaseadvisors.com>
Subject: [dba-SQLServer] MySQL to SQL Server Data Type Equivalents
Message-ID: <000e01cd8f60$13d45f90$3b7d1eb0$@net>
Content-Type: text/plain;       charset="us-ascii"

Here's an easy one (I'm not kidding!) for all you pros with a good working
knowledge of both MySQL and SQL Server. (Calling Arthur Fuller!)

>CREATE TABLE Accounts (
>
>account_id            INT PRIMARY KEY IDENTITY,
>
>account_name     VARCHAR(20),
>
>first_name            VARCHAR(20),
>
>last_name             VARCHAR(20),
>
>email                      VARCHAR(20),
>
>password_hash    CHAR(64),
>
>portrait_image     VARBINARY(MAX),
>
>hourly_rate           NUMERIC(9,2)           --  No change for this column
>
>);

Robert L. Stewart
www.WeBeDb.com
www.DBGUIDesign.com
www.RLStewartPhotography.com 


More information about the dba-SQLServer mailing list