Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors while trying to run the sql file #764

Open
Preyas552 opened this issue Feb 29, 2024 · 1 comment
Open

Errors while trying to run the sql file #764

Preyas552 opened this issue Feb 29, 2024 · 1 comment
Labels
bug Something isn't working question Further information is requested

Comments

@Preyas552
Copy link

Preyas552 commented Feb 29, 2024

Hi, I am getting a lot of errors if I try and run the SQL queries for all the queries in the SQL folder.
The countries query is having a lot of errors in it.


Msg 102, Level 15, State 1, Line 22
Incorrect syntax near '`'.
Msg 103, Level 15, State 4, Line 66
The identifier that starts with '}',-74.65000000,4.48000000,'??','U+1F1E6 U+1F1F6','2018-07-21 09:11:03','2023-08-11 17:31:40',1,NULL),(10,'Antigua and Barbuda',' is too long. Maximum length is 128.
Msg 103, Level 15, State 4, Line 66
The identifier that starts with '}',17.05000000,-61.80000000,'??','U+1F1E6 U+1F1EC','2018-07-21 09:11:03','2023-08-08 23:04:58',1,'Q781'),(11,'Argentina','ARG','' is too long. Maximum length is 128.
Msg 103, Level 15, State 4, Line 66
The identifier that starts with '}',-34.00000000,-64.00000000,'??','U+1F1E6 U+1F1F7','2018-07-21 09:11:03','2023-08-08 23:04:58',1,'Q414'),(12,'Armenia','ARM','0' is too long. Maximum length is 128.
Msg 103, Level 15, State 4, Line 66
The identifier that starts with '}',40.00000000,45.00000000,'??','U+1F1E6 U+1F1F2','2018-07-21 09:11:03','2023-08-08 23:04:58',1,'Q399'),(13,'Aruba','ABW','533',' is too long. Maximum length is 128.
Msg 103, Level 15, State 4, Line 66
The identifier that starts with '}',12.50000000,-69.96666666,'??','U+1F1E6 U+1F1FC','2018-07-21 09:11:03','2023-08-08 23:04:58',1,NULL),(14,'Australia','AUS','03' is too long. Maximum length is 128.
Msg 103, Level 15, State 4, Line 66
The identifier that starts with '}',-27.00000000,133.00000000,'??','U+1F1E6 U+1F1FA','2018-07-21 09:11:03','2023-08-08 23:04:58',1,'Q408'),(15,'Austria','AUT','0' is too long. Maximum length is 128.
Msg 103, Level 15, State 4, Line 66
The identifier that starts with '}',47.33333333,13.33333333,'??','U+1F1E6 U+1F1F9','2018-07-21 09:11:03','2023-08-08 23:04:58',1,'Q40'),(16,'Azerbaijan','AZE','0' is too long. Maximum length is 128.
Msg 103, Level 15, State 4, Line 66
The identifier that starts with '}',40.50000000,47.50000000,'??','U+1F1E6 U+1F1FF','2018-07-21 09:11:03','2023-08-08 23:04:58',1,'Q227'),(17,'The Bahamas','BHS',' is too long. Maximum length is 128.
Msg 103, Level 15, State 4, Line 66
The identifier that starts with '}',24.25000000,-76.00000000,'??','U+1F1E7 U+1F1F8','2018-07-21 09:11:03','2023-08-08 23:04:58',1,'Q778'),(18,'Bahrain','BHR','04' is too long. Maximum length is 128.
Msg 103, Level 15, State 4, Line 66
The identifier that starts with '}',26.00000000,50.55000000,'??','U+1F1E7 U+1F1ED','2018-07-21 09:11:03','2023-08-08 23:04:58',1,'Q398'),(19,'Bangladesh','BGD','' is too long. Maximum length is 128.
Msg 103, Level 15, State 4, Line 66
The identifier that starts with '}',24.00000000,90.00000000,'??','U+1F1E7 U+1F1E9','2018-07-21 09:11:03','2023-08-08 23:04:58',1,'Q902'),(20,'Barbados','BRB','05' is too long. Maximum length is 128.
Msg 103, Level 15, State 4, Line 66
The identifier that starts with '}',13.16666666,-59.53333333,'??','U+1F1E7 U+1F1E7','2018-07-21 09:11:03','2023-08-08 23:04:58',1,'Q244'),(21,'Belarus','BLR','11' is too long. Maximum length is 128.

The above are some queries, is there anything that I can do?
I am trying to run the query on Microsoft Sql Server Management Studio

Copy link

dosubot bot commented Feb 29, 2024

🤖

The errors you're encountering are due to the fact that the SQL scripts in the repository are written for MySQL, not Microsoft SQL Server. The syntax and some features used in these scripts are specific to MySQL and are not directly compatible with SQL Server, hence the errors.

To resolve these issues, you'll need to convert the MySQL scripts to SQL Server scripts. This involves several steps, including adjusting data types, modifying auto increment syntax, adjusting default values, and removing or replacing MySQL-specific commands and syntax. Here's a simplified example of how you might start to convert the table creation part of your script for SQL Server:

CREATE TABLE countries (
  id int IDENTITY(1,1) PRIMARY KEY,
  name varchar(100) NOT NULL,
  iso3 char(3) DEFAULT NULL,
  numeric_code char(3) DEFAULT NULL,
  iso2 char(2) DEFAULT NULL,
  phonecode varchar(255) DEFAULT NULL,
  capital varchar(255) DEFAULT NULL,
  currency varchar(255) DEFAULT NULL,
  currency_name varchar(255) DEFAULT NULL,
  currency_symbol varchar(255) DEFAULT NULL,
  tld varchar(255) DEFAULT NULL,
  [native] varchar(255) DEFAULT NULL,
  region varchar(255) DEFAULT NULL,
  region_id int DEFAULT NULL,
  subregion varchar(255) DEFAULT NULL,
  subregion_id int DEFAULT NULL,
  nationality varchar(255) DEFAULT NULL,
  timezones text,
  translations text,
  latitude decimal(10,8) DEFAULT NULL,
  longitude decimal(11,8) DEFAULT NULL,
  emoji varchar(191) DEFAULT NULL,
  emojiU varchar(191) DEFAULT NULL,
  created_at datetime2 NULL DEFAULT NULL,
  updated_at datetime2 NOT NULL,
  flag tinyint NOT NULL DEFAULT '1',
  wikiDataId varchar(255) DEFAULT NULL
);

This is just a starting point. Depending on the specific errors you're encountering, additional modifications might be necessary. You'll also need to convert the INSERT statements and any other parts of the script accordingly.

For more detailed information on how to convert MySQL scripts to SQL Server scripts, you might find this MySQL to SQL Server Conversion Guide helpful.

Please note that this conversion process can be complex and time-consuming, especially for larger scripts. If you're frequently working with both MySQL and SQL Server, you might want to consider using a database migration tool to automate some of these tasks.

I hope this helps! If you have any further questions or run into any issues during the conversion process, please don't hesitate to ask.

Sources

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@dosubot dosubot bot added bug Something isn't working question Further information is requested labels Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant