Advertisement
Guest User

SQL errors

a guest
Feb 19th, 2019
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.85 KB | None | 0 0
  1. $ cat test.SQL
  2. SET @DB_DATABASE_NAME = 'test_db';
  3. SET @DB_TABLE_NUMBERS = 'name_number';
  4.  
  5. DROP DATABASE IF EXISTS @DB_DATABASE_NAME;
  6. CREATE DATABASE IF NOT EXISTS @DB_DATABASE_NAME;
  7.  
  8. USE @DB_DATABASE_NAME;
  9.  
  10. CREATE TABLE IF NOT EXISTS @DB_TABLE_NUMBERS
  11. (
  12.         `nn_id` INT PRIMARY KEY AUTO_INCREMENT,
  13.         `nn_name` VARCHAR(64) CHARACTER SET utf8,
  14.         `nn_number` VARCHAR(18) CHARACTER SET utf8
  15. );
  16.  
  17. $ mysql -v -uroot -pXXX < test.SQL
  18. --------------
  19. SET @DB_DATABASE_NAME = 'test_db'
  20. --------------
  21.  
  22. --------------
  23. SET @DB_TABLE_NUMBERS = 'name_number'
  24. --------------
  25.  
  26. --------------
  27. DROP DATABASE IF EXISTS @DB_DATABASE_NAME
  28. --------------
  29.  
  30. ERROR 1064 (42000) at line 4: You have an error IN your SQL syntax; CHECK the manual that corresponds TO your MariaDB server version FOR the RIGHT syntax TO USE near '@DB_DATABASE_NAME' at line 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement