Errors Importing SQL File

dnichols's profile image dnichols posted 11 months ago in General Permalink

I am trying to import an SQL file but keep getting 102 errors stating, "Incorrect syntax near the keyword ..."

This happens on every single statement that it's trying to insert. I used the export function in HeidiSQL to export the SQL file and have also tried to change the output directly to the new server I am trying to import this into but it still gives the same error. Here is an example of one statement that is failing (this happens with every single one though).

CREATE TABLE IF NOT EXISTS "Alerts" ( "Id" UNIQUEIDENTIFIER NOT NULL, "AlertName" VARCHAR(50) NULL DEFAULT NULL COLLATE 'SQL_Latin1_General_CP1_CI_AS', "Enabled" INT NOT NULL DEFAULT '(0)', "InitialDisplayType" CHAR(1) NOT NULL DEFAULT '''O''' COLLATE 'SQL_Latin1_General_CP1_CI_AS', "AfterVisits" INT NULL DEFAULT '(5)', "TimeframeType" CHAR(1) NOT NULL DEFAULT '''B''' COLLATE 'SQL_Latin1_General_CP1_CI_AS', "CalendarType" VARCHAR(10) NOT NULL DEFAULT '''Year''' COLLATE 'SQL_Latin1_General_CP1_CI_AS', "RollingDays" INT NOT NULL DEFAULT '(90)', "Instructions" VARCHAR(4096) NULL DEFAULT NULL COLLATE 'SQL_Latin1_General_CP1_CI_AS', "StopFlagType" CHAR(1) NOT NULL DEFAULT '''N''' COLLATE 'SQL_Latin1_General_CP1_CI_AS', "StopVisits" INT NOT NULL DEFAULT '(1)', "CategoryId" VARCHAR(40) NULL DEFAULT NULL COLLATE 'SQL_Latin1_General_CP1_CI_AS', "SiteId" UNIQUEIDENTIFIER NULL DEFAULT NULL, FOREIGN KEY INDEX "fk_Alerts_Site" ("SiteId"), PRIMARY KEY ("Id"), CONSTRAINT "fk_Alerts_Site" FOREIGN KEY ("SiteId") REFERENCES "Site" ("Id") ON UPDATE NO_ACTION ON DELETE NO_ACTION );

Thank you for any suggestions you may have!

dnichols's profile image dnichols posted 11 months ago Permalink

In case it makes a difference, I am exporting from SQL 2012 SP4 to SQL 2019 Express

ansgar's profile image ansgar posted 11 months ago Permalink

The export seems to be created by HeidiSQL. The CREATE statements are only valid for MySQL and MariaDB, but not for SQL Server.

dnichols's profile image dnichols posted 11 months ago Permalink

Ah, that makes sense then. I assumed it would export it in whatever version it was coming from. Thank you for the quick reply and the great product!

Please login to leave a reply, or register at first.