char,varchar,text,blob

戻る

DROP TABLE IF EXISTS test_char; CREATE TABLE test_char ( id INT AUTO_INCREMENT, partsid char(200), PRIMARY KEY (id) ); INSERT INTO test_char (partsid) VALUES("38"); SELECT * FROM test_char; --------------------- C:\database\sql>mysql cookbook < test_char.sql -u cbuser -p Enter password: ****** id partsid 1 38 ----------------------------------------------- ==> partsid char(400), C:\database\sql>mysql cookbook < test_char.sql -u cbuser -p Enter password: ****** ERROR 1074 (42000) at line 2: Column length too big for column 'partsid' (max = 255); use BLOB or TEXT instead ----------------------------------------------- DROP TABLE IF EXISTS test_char; CREATE TABLE test_char ( id INT AUTO_INCREMENT, partsid varchar(400), PRIMARY KEY (id) ); INSERT INTO test_char (partsid) VALUES("2=3=4==16=23="); SELECT * FROM test_char; ----------------------------------------------- DROP TABLE IF EXISTS test_char; CREATE TABLE test_char ( id INT AUTO_INCREMENT, partsid varchar(400), PRIMARY KEY (id) ); INSERT INTO test_char (partsid) VALUES("123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890"); SELECT * FROM test_char; C:\database\sql>mysql cookbook < test_char.sql -u cbuser -p Enter password: ****** ERROR 1406 (22001) at line 9: Data too long for column 'partsid' at row 1 ----------------------------------------------- DROP TABLE IF EXISTS test_char; CREATE TABLE test_char ( id INT AUTO_INCREMENT, partsid text, PRIMARY KEY (id) ); INSERT INTO test_char (partsid) VALUES("123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890"); SELECT * FROM test_char; C:\database\sql>mysql cookbook < test_char.sql -u cbuser -p Enter password: ****** id partsid 1 123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890 -------------------------------------------------- DROP TABLE IF EXISTS test_char; CREATE TABLE test_char ( id INT AUTO_INCREMENT, partsid blob, PRIMARY KEY (id) ); INSERT INTO test_char (partsid) VALUES("123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890"); SELECT * FROM test_char; C:\database\sql>mysql cookbook < test_char.sql -u cbuser -p Enter password: ****** id partsid 1 123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012 34567890
戻る