I was wondering if anyone might be able to offer some 'guidance'. I'mtrying > create a few simple tables to demonstrate a bigger problem I'm
I try to create the first table I get my arch-nemesis, the dreaded ERROR 106 (42000)./***********************************************/
Here's the really simple table I'm trying to create:
CREATE TABLE atbl
(
atblnum INT UNSIGNED NOT NULL PRIMARY KEY,
description VARCHAR NULL,
btbl INT UNSIGNED NULL,
ctbl INT UNSIGNED NULL
);
Here's the error I'm getting:
mysql> source ~/prog/createtable.sql;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual t corresponds to your MySQL server version for the right syntax to use near 'NULL,
btbl INT UNSIGNED NULL,
ctbl INT UNSIGNED NULL
)' at line 4
I swear I've created a hundred tables and I know I'm prone to stupid syntax errors, but for the life of me I can't see what I'm doing wrong here.
Chris
Subject: Mysql Table Creation Issue
@VIA: DMINE
@MSGID: <4EA34C86.1488.dove-prg@dmine.net>
@TZ: c12c
I was wondering if anyone might be able to offer some 'guidance'. I'm trying create a few simple tables to demonstrate a bigger problem I'm having and wh I try to create the first table I get my arch-nemesis, the dreaded ERROR 106 (42000).
Here's the really simple table I'm trying to create:
CREATE TABLE atbl
(
atblnum INT UNSIGNED NOT NULL PRIMARY KEY,
description VARCHAR NULL,
btbl INT UNSIGNED NULL,
ctbl INT UNSIGNED NULL
);
Here's the error I'm getting:
mysql> source ~/prog/createtable.sql;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual t corresponds to your MySQL server version for the right syntax to use near 'NULL,
btbl INT UNSIGNED NULL,
ctbl INT UNSIGNED NULL
)' at line 4
I swear I've created a hundred tables and I know I'm prone to stupid syntax errors, but for the life of me I can't see what I'm doing wrong here.
Chris
try stronger nails.... lol
"Practise safe Lunch, Use a Condiment"
Ok, problem solved.
It was a dumb mistake as expected.
I needed to specify a length for VARCHAR:
description VARCHAR NULL,
Should have been:
description VARCHAR(20) NULL,
Of course '20' could have been any number between 1 and 255 according to my slightly out of date book.
MS-SQL introduced a VARCHAR/NVARCHAR(MAX) that basically combines varchar/nvarchar, and text/ntext for example.
YMMV.
--
Hi Michael,
MS-SQL introduced a VARCHAR/NVARCHAR(MAX) that basically combines
varchar/nvarchar, and text/ntext for example.
YMMV.
This was the first I heard of NVARCHAR. I did a quick google of it and it sounds like the only difference is that it stores unicode characters. Does that
sound right?
Sysop: | Eric Oulashin |
---|---|
Location: | Beaverton, Oregon, USA |
Users: | 105 |
Nodes: | 16 (0 / 16) |
Uptime: | 09:37:19 |
Calls: | 5,904 |
Calls today: | 4 |
Files: | 8,496 |
D/L today: |
374 files (144M bytes) |
Messages: | 343,294 |