You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to generate a sample data in MySQL database with below command. In ADS, it always return error "1064 (42000): 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 'DELIMITER $$
CREATE PROCEDURE InsertRandomCustomers(IN num_records INT)
BEGIN
' at line 1".
However the same statement works normal in MySQL workbench. Please help to fix it.
USE tutorialdb;
SET @names = 'Orlando,Keith,Donna,Janet,Alice,Bob,Carol,David,Emma,Frank,Grace,Henry,Ivy,Jack,Kate,Liam,Mia,Nathan,Olivia,Peter,Quinn,Rachel,Simon,Tina,Victor,Wendy,Xavier,Yvonne,Zach';
SET @countries = 'China,United States,Russia,India,Brazil,South Africa,Mexico,Australia,Japan,Germany';
DELIMITER $$
CREATE PROCEDURE InsertRandomCustomersaa(IN num_records INT)
BEGIN
DECLARE i INT DEFAULT 1895;
DECLARE random_name VARCHAR(255);
DECLARE random_location VARCHAR(255);
WHILE i < num_records DO
SET random_name = SUBSTRING_INDEX(SUBSTRING_INDEX(@names, ',', FLOOR(RAND() * 26) + 1), ',', -1);
SET random_location = SUBSTRING_INDEX(SUBSTRING_INDEX(@countries, ',', FLOOR(RAND() * 10) + 1), ',', -1);
INSERT INTO customers (name, location, email)
VALUES (random_name, random_location, CONCAT(random_name, '@adventure-works.com'));
SET i = i + 1;
END WHILE;
END$$
DELIMITER ;
CALL InsertRandomCustomersaa(10000);
The text was updated successfully, but these errors were encountered:
I tried to generate a sample data in MySQL database with below command. In ADS, it always return error "1064 (42000): 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 'DELIMITER $$
CREATE PROCEDURE InsertRandomCustomers(IN num_records INT)
BEGIN
' at line 1".
However the same statement works normal in MySQL workbench. Please help to fix it.
The text was updated successfully, but these errors were encountered: