I won't translate all of it but I can show you the patterns. See comments 
interspersed....

"Ed" <[EMAIL PROTECTED]> wrote on 10/25/2005 11:57:21 AM:

> Hi all,
> I am doing a tutorial to make a shopping cart. I need to make a mysql db 
or 
> convert an sql db to mysql.
> Can anyone give me any pointers as to how to make the following tables?
> The Microsoft SQL Server 2000 creation script is below the tables. 
Thanks a 
> lot for any pointers to get me started off- I will use php admin to make 
the 
> table
> 
> Categories:
> int_CategoryID int IDENTITY
> txt_Category nvarchar(100)
> bit_Active bit
> 
<snip>
> <!----- SQL Create Script Begins ------>
> if exists (select * from sysobjects where id = 
> object_id(N'[dbo].[Categories]') and OBJECTPROPERTY(id, N'IsUserTable') 
= 1)
> drop table [dbo].[Categories]
> GO

MySQL equivalent:

DROP TABLE IF EXISTS Categories;

<snip>
> 
> CREATE TABLE [dbo].[Categories] (
> [int_CategoryID] [int] IDENTITY (1, 1) NOT NULL ,
> [txt_Category] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS 
NULL ,
> [bit_Active] [bit] NULL
> ) ON [PRIMARY]
> GO

Rule 1: change all [] around column names to ``
Rule 2: convert column types to a MySQL equivalent. See: 
http://dev.mysql.com/doc/refman/5.0/en/column-types.html
Rule 3: collation rules can sometimes be hard to set up correctly. Unless 
you need language-specific collations, stick with the defaults.
Rule 4: if you need transactions, use the InnoDB engine. If not, use 
whatever fits.

MySQL example (compare to the text description you posted first):

CREATE TABLE Categories (
  `int_CategoryID` INT AUTO_INCREMENT NOT NULL,
  `txt_Category` VARCHAR(100) default NULL,
  `bit_Active` BIT default NULL
) ENGINE=MyISAM;

<snip>
> 

HTH!

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Reply via email to