MySQL Forums
Forum List  »  Newbie

Problems with DECLARE statement in SQL script
Posted by: Ken Wood
Date: March 19, 2018 09:24AM

Hello,

I recently purchased the "Data Analysis Using SQL & Excel", 2nd edition, by Gordon Linoff. There are a number of data files (in .txt format) that are provided with the book that I am trying to load into MySQL on my Mac. The author provides a SQL script file which is supposed to accomplish this. I have tried running the script and I immediately get errors.

Here are the instructions that the author provides in script file:

/*
* Download SQL Server from the web (from www.microsoft.com) and install on machine.
* Then:
* 1) Download data into some directory on the machine
* 2) Open SQL Server Management Studio
* 3) Set @LOADDIR in this script to the directory where you downloaded the files
*/

USE SQLBook

DECLARE @LOADDIR VARCHAR(255) = '/Users/woodzsan/Desktop/SQLBookData';
DECLARE @SQL NVARCHAR(MAX);

The error message I get is:

Error Code: 1064. 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 'DECLARE @LOADDIR VARCHAR(255) = '/Users/woodzsan/Desktop/SQLBookData'' at line 3

The data files are located in a folder called SQLBookData on my Mac Desktop.
Being a MySQL neophyte, I have no idea what to do there.

Please help...thanks!

Ken Wood

Options: ReplyQuote


Subject
Written By
Posted
Problems with DECLARE statement in SQL script
March 19, 2018 09:24AM
March 19, 2018 11:33AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.