Importing .sql file into SQL Server 2012 - sql

I have database with .sql, I want to import that .sql file into SQL Server 2012 using Management Studio.
When I tried to import the data, I'm getting an error:
Msg 156, Level 15, State 1, Line 76
Incorrect syntax near the keyword 'NOT'.
[![enter image description here][1]][1]
CREATE TABLE ct_bookings(
id int NOT NULL,
order_id bigint NOT NULL,
client_id bigint NOT NULL,
order_date date NOT NULL,
booking_date_time datetime NOT NULL,
service_id int NOT NULL,
method_id int NOT NULL,
method_unit_id int NOT NULL,
method_unit_qty int NOT NULL,
method_unit_qty_rate double NOT NULL,
booking_status varchar(10) not null ('A','C','R','CC','CS','CO','MN','RS') NOT NULL COMMENT 'A=active, C=confirm, R=Reject, CC=Cancel by Client, CS=Cancel by service provider,CO=Completed,MN=MARK AS NOSHOW',
`reject_reason` varchar(200) NOT NULL,
`reminder_status` enum('0','1') NOT NULL DEFAULT '0' COMMENT '0=Email Not Sent,1=Email Sent',
`lastmodify` datetime NOT NULL,
`read_status` enum('R','U') NOT NULL DEFAULT 'U'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
How can I solve this issue?
Please help me out. Thanks in advance.

in MySQL:-
CREATE TABLE ct_addon_service_rate(
id int(11) NOT NULL,
addon_service_id int(11) NOT NULL,
unit varchar(20) NOT NULL,
rules VARCHAR(10) NOT NULL CHECK (rules IN('E', 'G')),
rate DOUBLE NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Equals in SQL Server:-
Create TABLE ct_addon_service_rate (
id int NOT NULL,
addon_service_id int NOT NULL,
unit varchar(20) NOT NULL,
rules char(1) not null,
rate FLOAT(25) NOT NULL,
CHECK (rules in ('E', 'G'))
)
Update:-
In MySQL:-
CREATE TABLE ct_bookings(
id int NOT NULL,
order_id bigint NOT NULL,
client_id bigint NOT NULL,
order_date date NOT NULL,
booking_date_time datetime NOT NULL,
service_id int NOT NULL,
method_id int NOT NULL,
method_unit_id int NOT NULL,
method_unit_qty int NOT NULL,
method_unit_qty_rate double NOT NULL,
booking_status varchar(10) not null ('A','C','R','CC','CS','CO','MN','RS') NOT NULL COMMENT 'A=active, C=confirm, R=Reject, CC=Cancel by Client, CS=Cancel by service provider,CO=Completed,MN=MARK AS NOSHOW',
`reject_reason` varchar(200) NOT NULL,
`reminder_status` enum('0','1') NOT NULL DEFAULT '0' COMMENT '0=Email Not Sent,1=Email Sent',
`lastmodify` datetime NOT NULL,
`read_status` enum('R','U') NOT NULL DEFAULT 'U'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Equals in SQL Server:-
CREATE TABLE ct_bookings(
id int NOT NULL,
order_id bigint NOT NULL,
client_id bigint NOT NULL,
order_date date NOT NULL,
booking_date_time datetime NOT NULL,
service_id int NOT NULL,
method_id int NOT NULL,
method_unit_id int NOT NULL,
method_unit_qty int NOT NULL,
method_unit_qty_rate float(25) NOT NULL,
booking_status varchar(10) not null check (booking_status in ('A','C','R','CC','CS','CO','MN','RS')),
/*COMMENT 'A=active, C=confirm, R=Reject, CC=Cancel by Client, CS=Cancel by service provider,CO=Completed,MN=MARK AS NOSHOW', */
reject_reason varchar(200) NOT NULL,
reminder_status char(1)NOT NULL check (reminder_status in ('0','1')) DEFAULT '0', /*COMMENT '0=Email Not Sent,1=Email Sent', */
lastmodify datetime NOT NULL,
read_status char(1) NOT NULL check (read_status in ('R','U')) DEFAULT 'U'
)
Update 2:-
in MySQL:-
CREATE TABLE ct_email_templates (
id int NOT NULL,
email_subject varchar(200) COLLATE Latin1_General_CI_AS NOT NULL,
email_message text COLLATE Latin1_General_CI_AS NOT NULL,
default_message text COLLATE Latin1_General_CI_AS NOT NULL,
email_template_status varchar(10) NOT NULL check(email_template_status in('E','D')) COLLATE Latin1_General_CI_AS,
email_template_type varchar(10) check(email_template_type IN('A','C','R','CC','RS','RM')) COLLATE Latin1_General_CI_AS NOT NULL COMMENT 'A=active, C=confirm, R=Reject, CC=Cancel by Client, RS=Reschedule, RM=Reminder',
user_type` enum('A','C') COLLATE utf8_unicode_ci NOT NULL COMMENT 'A=Admin,C=client'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
Equals in SQL Server:-
CREATE TABLE ct_email_templates (
id int NOT NULL,
email_subject varchar(200) COLLATE Latin1_General_CI_AS NOT NULL,
email_message text COLLATE Latin1_General_CI_AS NOT NULL,
default_message text COLLATE Latin1_General_CI_AS NOT NULL,
email_template_status varchar(10) COLLATE Latin1_General_CI_AS NOT NULL check(email_template_status in('E','D')) ,
email_template_type varchar(10) COLLATE Latin1_General_CI_AS check(email_template_type IN('A','C','R','CC','RS','RM')) NOT NULL, /*COMMENT 'A=active, C=confirm, R=Reject, CC=Cancel by Client, RS=Reschedule, RM=Reminder',
user_type` enum('A','C') COLLATE utf8_unicode_ci NOT NULL COMMENT 'A=Admin,C=client' */
)

Related

IBM SQL Database import not working

I am trying to import my sql schema in IBM SQL Database (sqldb_free plan)
CREATE TABLE User (
id INT NOT NULL AUTO_INCREMENT,
username VARCHAR(45) NOT NULL,
password VARCHAR(120) NULL,
salt VARCHAR(45) NULL,
authData VARCHAR(45) NULL,
CreditCardId VARCHAR(120) NULL,
DisplayUsername VARCHAR(120) NOT NULL,
email VARCHAR(120) NOT NULL,
cashBalance FLOAT NULL DEFAULT 0,
city VARCHAR(45) NULL,
country VARCHAR(45) NULL,
dob TIMESTAMP(4) NULL,
firstName VARCHAR(45) NOT NULL,
lastName VARCHAR(45) NULL,
gender TINYINT(1) NULL DEFAULT 1,
playerPoints INT NULL DEFAULT 0,
state CHAR(2) NULL,
tickets INT NULL,
userImage VARCHAR(240) NULL,
createdAt TIMESTAMP(4) NOT NULL DEFAULT CURRENT_TIMESTAMP,
revision VARCHAR(20) NULL,
cakeReqId VARCHAR(15) NULL,
cakeAffId VARCHAR(15) NULL,
signUpEvent TINYINT(1) NOT NULL DEFAULT 0,
depositEvent TINYINT(1) NOT NULL DEFAULT 0,
SignupSource VARCHAR(20) NULL,
TotalSpent FLOAT NULL DEFAULT 0,
address VARCHAR(120) NULL,
phone VARCHAR(45) NULL,
TicketTransferrable INT NULL,
updatedAt TIMESTAMP(4) NOT NULL DEFAULT CURRENT_TIMESTAMP,
FavouriteTeam INT NULL,
UNIQUE INDEX email_UNIQUE (email ASC),
PRIMARY KEY (id));
And the error message is
DDL failed with message
_ Exception. _ state = 42601; error code = -104; error Message = Error for batch element #1: An unexpected token "," was found following "NULL AUTO_INCREMENT". Expected tokens may include: "".. _CODE=-104, _STATE=42601, DRIVER=3.66.46
How can i fix this?
The DDL statement have the following issues:
DB2 does not support the "AUTO_INCREMENT" replace with "GENERATED ALWAYS AS IDENTITY".
DB2 does not support the TINYINT datatype replace with INT or CHARACTER(1) depends of your data.
CREATE UNIQUE INDEX separately, delete "UNIQUE INDEX email_UNIQUE (email ASC)," and add a DDL index.
Following as you could fix it:
CREATE TABLE User (
id INT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1 INCREMENT BY 1),
username VARCHAR(45) NOT NULL,
password VARCHAR(120) NULL,
salt VARCHAR(45) NULL,
authData VARCHAR(45) NULL,
CreditCardId VARCHAR(120) NULL,
DisplayUsername VARCHAR(120) NOT NULL,
email VARCHAR(120) NOT NULL,
cashBalance FLOAT NULL DEFAULT 0,
city VARCHAR(45) NULL,
country VARCHAR(45) NULL,
dob TIMESTAMP(4) NULL,
firstName VARCHAR(45) NOT NULL,
lastName VARCHAR(45) NULL,
gender TINYINT(1) NULL DEFAULT 1,
playerPoints INT NULL DEFAULT 0,
state CHAR(2) NULL,
tickets INT NULL,
userImage VARCHAR(240) NULL,
createdAt TIMESTAMP(4) NOT NULL DEFAULT CURRENT_TIMESTAMP,
revision VARCHAR(20) NULL,
cakeReqId VARCHAR(15) NULL,
cakeAffId VARCHAR(15) NULL,
signUpEvent TINYINT(1) NOT NULL DEFAULT 0,
depositEvent TINYINT(1) NOT NULL DEFAULT 0,
SignupSource VARCHAR(20) NULL,
TotalSpent FLOAT NULL DEFAULT 0,
address VARCHAR(120) NULL,
phone VARCHAR(45) NULL,
TicketTransferrable INT NULL,
updatedAt TIMESTAMP(4) NOT NULL DEFAULT CURRENT_TIMESTAMP,
FavouriteTeam INT NULL,
PRIMARY KEY (id));
CREATE UNIQUE INDEX email_UNIQUE
ON user
(
email ASC
)
;

SQL table creation code gives error

could someone have a look at this for me, I can't seem to find why it is not working.
CREATE TABLE Person(
Person_ID int auto_increment NOT NULL,
Person_Type_ID int NOT NULL,
Create_Date datetime NOT NULL ,
Modify_Date datetime NOT NULL ,
First_Name varchar(50) NOT NULL,
Surname varchar(50) NOT NULL,
DOB date NOT NULL,
Gender char(1) NOT NULL CHECK (Gender ='f' OR Gender ='m'),
Archive char(1) NULL,
Allergies varchar(200) NOT NULL,
Dietry_Requirements varchar(200) NOT NULL,
Disabilities varchar(200) NOT NULL,
Medicine_Requirements varchar(200) NOT NULL,
username varchar (30) NOT NULL,
password varchar (30) NOT NULL,
CONSTRAINT PK_Person_ID PRIMARY KEY (Person_ID)
CONSTRAINT FK_Person_Type_ID FOREIGN KEY (Person_Type_ID)
REFERENCES Person_Type (Person_Type_ID));
You missed a comma! This should work...
CREATE TABLE Person(
Person_ID int auto_increment NOT NULL,
Person_Type_ID int NOT NULL,
Create_Date datetime NOT NULL ,
Modify_Date datetime NOT NULL ,
First_Name varchar(50) NOT NULL,
Surname varchar(50) NOT NULL,
DOB date NOT NULL,
Gender char(1) NOT NULL CHECK (Gender ='f' OR Gender ='m'),
Archive char(1) NULL,
Allergies varchar(200) NOT NULL,
Dietry_Requirements varchar(200) NOT NULL,
Disabilities varchar(200) NOT NULL,
Medicine_Requirements varchar(200) NOT NULL,
username varchar (30) NOT NULL,
password varchar (30) NOT NULL,
CONSTRAINT PK_Person_ID PRIMARY KEY (Person_ID),
CONSTRAINT FK_Person_Type_ID FOREIGN KEY (Person_Type_ID)
REFERENCES Person_Type (Person_Type_ID));

problem in getting count

Here is my table complete schema , i want to get the each category sale count ,
How to get that each category sale count ,
CREATE TABLE IF NOT EXISTS `tblbasket` (
`BID` int(20) NOT NULL
AUTO_INCREMENT,
`BasketSessionID` varchar(100) NOT NULL DEFAULT '0',
`ProductCode` varchar(50) NOT NULL,
`Quantity` int(20) NOT NULL,
`AfterDiscount` double NOT NULL DEFAULT '0',
`ProductCost` double NOT NULL,
`SaleMode` varchar(10) NOT NULL DEFAULT 'p' COMMENT 'p Price f Free',
`BillType` varchar(5) NOT NULL DEFAULT 's' COMMENT 's sale r Returns',
`EntryUser` int(20) NOT NULL,
`EntryTimestamp` int(50) NOT NULL,
`EntryDate` datetime NOT NULL,
`UpdatedUser` int(20) NOT NULL,
`UpdatedDate` datetime NOT NULL,
`Status` int(3) NOT NULL DEFAULT '1',
PRIMARY KEY (`BID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
CREATE TABLE IF NOT EXISTS `tblcategory` (
`CatID` int(11) NOT NULL AUTO_INCREMENT,
`CatName` varchar(20) NOT NULL,
`Discount` int(11) NOT NULL,
`EntryUser` int(10) NOT NULL,
`EntryDate` datetime NOT NULL,
`UpdateUser` int(20) NOT NULL,
`UpdatedDate` datetime NOT NULL,
`Status` int(3) NOT NULL DEFAULT '1',
PRIMARY KEY (`CatID`),
KEY `CatName` (`CatName`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;
CREATE TABLE IF NOT EXISTS `tblsale` ( `SaleID` int(20) NOT NULL AUTO_INCREMENT,
`BillNo` varchar(30) NOT NULL DEFAULT '0',
`BasketSessionID` varchar(200) NOT NULL,
`AfterDiscount` double NOT NULL,
`ProductCost` double NOT NULL, `VAT` int(20) NOT NULL DEFAULT '0',
`BillType` varchar(5) NOT NULL DEFAULT 's' COMMENT 'same like tblbasket table',
`EntryUser` int(20) NOT NULL,
`EntryDate` datetime NOT NULL,
`UpdatedUser` int(20) NOT NULL,
`UpdateDate` datetime NOT NULL,
`OfficeNotesTS` text NOT NULL,
`Status` int(5) NOT NULL DEFAULT '1',
PRIMARY KEY (`SaleID`),
UNIQUE KEY `BillNo` (`BillNo`),
UNIQUE KEY `BasketSessionID` (`BasketSessionID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
CREATE TABLE IF NOT EXISTS `tblstock` (
`StockID` int(20) NOT NULL AUTO_INCREMENT,
`ProductCode` varchar(50) NOT NULL,
`ManufacturerID` int(20) NOT NULL,
`CategoryID` int(20) NOT NULL,
`ProductTitle` varchar(150) NOT NULL,
`Timestamp` int(50) NOT NULL,
`EntryUser` int(20) NOT NULL,
`EntryDate` datetime NOT NULL,
`UpdateUser` int(20) NOT NULL,
`UpdatedDate` datetime NOT NULL,
`Status` int(3) NOT NULL DEFAULT '1',
PRIMARY KEY (`StockID`),
KEY `ManufacturerID` (`ManufacturerID`),
KEY `CategoryID` (`CategoryID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2175 ;
CREATE TABLE IF NOT EXISTS `tblstockhistory` (
`STID` int(20) NOT NULL AUTO_INCREMENT,
`StockID` int(20) NOT NULL,
`SupplierID` int(20) NOT NULL,
`InvoiceNO` varchar(20) NOT NULL,
`InvoiceDate` datetime NOT NULL,
`InvoiceAmount` float NOT NULL DEFAULT '0',
`Quantity` int(20) NOT NULL,
`Cost` float NOT NULL,
`MRP` float NOT NULL,
`Discount` int(20) NOT NULL DEFAULT '0',
`VAT` float NOT NULL,
`EntryUser` int(10) NOT NULL,
`EntryDate` datetime NOT NULL,
`UpdateUser` int(20) NOT NULL,
`UpdatedDate` datetime NOT NULL,
`Status` int(10) NOT NULL DEFAULT '1',
PRIMARY KEY (`STID`),
KEY `StockID` (`StockID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2190 ;
ALTER TABLE `tblstock`
ADD CONSTRAINT `tblStock_ibfk_1`
FOREIGN KEY (`ManufacturerID`)
REFERENCES `tblmanufacturer` (`ManufacturerID`);
ALTER TABLE `tblstockhistory`
ADD CONSTRAINT `tblStockHistory_ibfk_1`
FOREIGN KEY (`StockID`)
REFERENCES `tblstock` (`StockID`);
try something like that (its hard to understand without foreign key, and little explain ):
SELECT st.CategoryID,SUM(b.ProductCost*b.Quantity) FROM tblsale s
LEFT JOIN tblbasket b ON b.BasketSessionID = s.BasketSessionID
LEFT JOIN tblstock st ON st.ProductCode = b.ProductCode GROUP BY st.CategoryID

mass replace of values in more tables by a highest value

I have a table with OWN_ID and OWN_Email -
own_id | own_email
-----------------------------------------------
3ace7cf80edd | email#example.com
3acf6af33ff7 | email#example.com
3acda2524e00 | email#example.com
3ad75583c9a7 | spam#example.com
3ad74b018999 | spam#example.com
etc.
the problem is that it should contain only a single ID per Email, also I need to replace all OWN_ID values in another table by highest OWN_ID value of the OWN_Email
sql create:
CREATE TABLE `blahblah.`eventowner` (
`OWN_ID` varchar(12) COLLATE utf8_czech_ci NOT NULL DEFAULT '',
`OWN_Email` varchar(120) COLLATE utf8_czech_ci DEFAULT NULL,
`OwnDateFormat` varchar(16) COLLATE utf8_czech_ci DEFAULT NULL,
`OwnWeekStart` int(11) DEFAULT NULL,
`OwnDayStart` int(11) DEFAULT NULL,
`OwnDayEnd` int(11) DEFAULT NULL,
PRIMARY KEY (`OWN_ID`),
KEY `OwnerEmailIndex` (`OWN_Email`),
KEY `OwnerIndex` (`OWN_ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci
CREATE TABLE `blahblah`.`event` (
`EVN_ID` varchar(128) COLLATE utf8_czech_ci DEFAULT NULL,
`EVNGRP_ID` varchar(12) COLLATE utf8_czech_ci DEFAULT NULL,
`EVNOWN_ID` varchar(12) COLLATE utf8_czech_ci DEFAULT NULL,
`EVNRCR_ID` varchar(12) COLLATE utf8_czech_ci DEFAULT NULL,
`Evn_EditCounter` int(11) DEFAULT NULL,
`Evn_Created` int(11) DEFAULT NULL,
`Evn_Modified` int(11) DEFAULT NULL,
`EvnFolder` varchar(128) COLLATE utf8_czech_ci DEFAULT NULL,
`EvnTitle` varchar(255) COLLATE utf8_czech_ci DEFAULT NULL,
`EvnNote` text COLLATE utf8_czech_ci,
`EvnLocation` varchar(255) COLLATE utf8_czech_ci DEFAULT NULL,
`EvnPriority` int(11) DEFAULT NULL,
`EvnComplete` int(11) DEFAULT NULL,
`EvnColor` varchar(2) COLLATE utf8_czech_ci DEFAULT NULL,
`EvnClass` varchar(1) COLLATE utf8_czech_ci DEFAULT NULL,
`EvnShareType` varchar(1) COLLATE utf8_czech_ci DEFAULT NULL,
`EvnTimeFormat` varchar(1) COLLATE utf8_czech_ci DEFAULT NULL,
`EvnType` varchar(127) COLLATE utf8_czech_ci DEFAULT NULL,
`EvnStatus` varchar(1) COLLATE utf8_czech_ci DEFAULT NULL,
`EvnOrganizer` varchar(80) COLLATE utf8_czech_ci DEFAULT NULL,
`EvnContact` varchar(80) COLLATE utf8_czech_ci DEFAULT NULL,
`EvnURL` varchar(255) COLLATE utf8_czech_ci DEFAULT NULL,
`EvnStartDate` int(11) DEFAULT NULL,
`EvnStartTime` int(11) DEFAULT NULL,
`EvnEndDate` int(11) DEFAULT NULL,
`EvnEndTime` int(11) DEFAULT NULL,
`EvnRID` varchar(255) COLLATE utf8_czech_ci DEFAULT NULL,
`EvnUID` varchar(255) COLLATE utf8_czech_ci DEFAULT NULL,
`EvnExpire` int(11) DEFAULT NULL,
`EvnSequence` int(11) DEFAULT NULL,
`EvnFlags` int(11) DEFAULT NULL,
KEY `EventGroupClassIndex` (`EVNGRP_ID`,`EvnClass`),
KEY `EventGroupFolderIndex` (`EVN_ID`,`EVNGRP_ID`,`EvnFolder`),
KEY `EventRIDIndex` (`EvnRID`),
KEY `EventUIDIndex` (`EvnUID`),
KEY `EventGroupRCRIndex` (`EVN_ID`,`EVNGRP_ID`,`EVNRCR_ID`),
KEY `EventExpireIndex` (`EvnExpire`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci
delete t1 from table t1, table t2
where t1.own_email= t2.own_email
and t1.own_id < t2.own_id
update othertable, table
set othertable.own_id= table.own_id
where othertable.own_email= table.own_email;
Could accomplish this fairly simple using a transaction that nukes the whole table.
BEGIN;
SELECT own_email, max(own_Id) INTO temptable FROM table GROUP BY own_email
TRUNCATE table;
INSERT INTO table SELECT * FROM temptable;
DELETE temptable;
COMMIT;
But, that Isn't the best way -- you can also do it by deleting just the right rows.
DELETE FROM table AS d WHERE EXISTS (
SELECT own_id FROM table AS t
WHERE NOT EXISTS (
SELECT max(own_id) FROM table AS i
GROUP BY own_email
WHERE t.own_email = i.own_email
)
AND d.own_id = t.own_id
AND d.own_email = t.own_email
);
Here we delete all own_ids, that aren't the max(own_id) for an E-mail.
This can be accomplished with NOT IN (understanding the caveat on nulls), or an anti-join on the table being deleted from

Problem with SQL syntax (probably simple)

I'm doing some custom database work for a module for Drupal and I get the following SQL error when trying to create my table:
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT NULL, rooms INT DEFAULT NULL, adults INT DEFAULT NULL, children' at line 14 query: CREATE TABLE dr_enquiry ( eId INT unsigned NOT NULL auto_increment, eKey VARCHAR(16) NOT NULL, dateSent INT NOT NULL DEFAULT 0, status VARCHAR(30) NOT NULL DEFAULT 'Unanswered', custName VARCHAR(50) NOT NULL, custEmail VARCHAR(200) NOT NULL, custPhone VARCHAR(25) NOT NULL, custCountry VARCHAR(40) NOT NULL, custIP VARCHAR(11) DEFAULT NULL, offerName VARCHAR(100) NOT NULL, offerURL VARCHAR(200) NOT NULL, arrival DATETIME DEFAULT NULL, departure DEFAULT NULL, rooms INT DEFAULT NULL, adults INT DEFAULT NULL, children INT DEFAULT NULL, childAges VARCHAR(32) DEFAULT NULL, toddlers INT DEFAULT NULL, toddlerAges VARCHAR(32) DEFAULT NULL, catering VARCHAR(255) DEFAULT NULL, comments VARCHAR(255) DEFAULT NULL, agent VARCHAR(100) DEFAULT NULL, voucher VARCHAR(100) DEFAULT NULL, PRIMARY KEY (eId) ) /*!40100 DEFAULT CHARACTER SET UTF8 */ in /home/travelco/public_html/includes/database.inc on line 550.
The 'departure' field doesn't seem to have a type eg varchar, mediumint etc. Try adding one and see if that solves your problem :)
Nullability is not set using a DEFAULT constraint. Thus, the compiler is balking at each instance of DEFAULT NULL. Thus, the create statement should look like:
CREATE TABLE dr_enquiry (
eId INT unsigned NOT NULL auto_increment
, eKey VARCHAR(16) NOT NULL
, dateSent INT NOT NULL DEFAULT 0
, status VARCHAR(30) NOT NULL DEFAULT 'Unanswered'
, custName VARCHAR(50) NOT NULL
, custEmail VARCHAR(200) NOT NULL
, custPhone VARCHAR(25) NOT NULL
, custCountry VARCHAR(40) NOT NULL
, custIP VARCHAR(11) NULL
, offerName VARCHAR(100) NOT NULL
, offerURL VARCHAR(200) NOT NULL
, arrival DATETIME NULL
, departure DATETIME NULL
, rooms INT NULL
, adults INT NULL
, children INT NULL
, childAges VARCHAR(32) NULL
, toddlers INT NULL
, toddlerAges VARCHAR(32) NULL
, catering VARCHAR(255) NULL
, comments VARCHAR(255) NULL
, agent VARCHAR(100) NULL
, voucher VARCHAR(100) NULL
, PRIMARY KEY (eId)
)
(Oh and departure did not have a datatype as richsage mentioned. I presumed it was DateTime.)