« first day (3273 days earlier)      last day (1045 days later) » 

6:11 AM
@Jay only if you go in SQLCMD mode afaik
 
6:38 AM
Hi, I've got a personal project where I store messages and images from users in a DB. It worked fine until I decided I wanted to order by date, so I added an upload_date column, and now it gives me a syntax error "near MAX) NOT NULL"
DROP TABLE IF EXISTS messages;

CREATE TABLE messages (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(MAX) NOT NULL,
message VARCHAR(MAX) NOT NULL,
image VARCHAR(MAX),
thumbnail VARCHAR(MAX),
upload_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
that's the code I want to run
I can't spot the syntax error, I tried using DATETIME instead of TIMESTAMP
And I think the error is on the upload_date line since it does run without it
SQL flavour is MySQL running on MariaDB 10.3.27-MariaDB-0+deb10u1 Raspbian 10
 
its the "MAX"
CREATE TABLE messages (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(12345) NOT NULL,
message VARCHAR(12345) NOT NULL,
image VARCHAR(12345),
thumbnail VARCHAR(12345),
upload_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
this works on dbfiddle
 
morn
 
morning
 
Thanks Zulatin, I'll try it rn
Any idea why it worked just before ?
 
I work on SQL Server myself, but what i see when i google is that MySQL doesn't have varchar(max)
https://stackoverflow.com/questions/332798/equivalent-of-varcharmax-in-mysql
 
6:52 AM
Thanks, it did work. (12345 gave a "row size too large" error but 1234 did work)
 
np
 
 
7 hours later…
Jay
2:10 PM
@Zulatin okay thanks @Zulatin I appreciate it, I'm trying to streamline a process at work and this could chop off a chunk of manually clicking around a lot each time I do it
 

« first day (3273 days earlier)      last day (1045 days later) »