scarhand Posted February 29, 2008 Share Posted February 29, 2008 why is mysql automatically changing varchar to char? i NEED the column to use CHAR(20), but when i insert the sql into the database it is changing it to VARCHAR(20).... can anyone help me with this? Quote Link to comment https://forums.phpfreaks.com/topic/93753-mysql-automatically-changing-varchar-to-char/ Share on other sites More sharing options...
fenway Posted February 29, 2008 Share Posted February 29, 2008 Probably because there are other varchar columns.... Quote Link to comment https://forums.phpfreaks.com/topic/93753-mysql-automatically-changing-varchar-to-char/#findComment-480396 Share on other sites More sharing options...
scarhand Posted February 29, 2008 Author Share Posted February 29, 2008 i just changed the rest of the varchars to chars for that table, and now its automatically changing all of them to varchar... DROP TABLE IF EXISTS `test`; CREATE TABLE `test` ( `id` bigint(20) unsigned NOT NULL auto_increment, `category_id` bigint(20) unsigned NOT NULL, `uploader_id` bigint(20) unsigned NOT NULL, `info_hash` char(20) binary NOT NULL default '', `file_name` char(255) NOT NULL, `tsize` bigint(20) unsigned NOT NULL, `title` char(255) NOT NULL, `description` text NOT NULL, `date_uploaded` timestamp(14) NOT NULL, `rating` smallint(5) NOT NULL default '0', PRIMARY KEY (`id`) ); Quote Link to comment https://forums.phpfreaks.com/topic/93753-mysql-automatically-changing-varchar-to-char/#findComment-480397 Share on other sites More sharing options...
scarhand Posted February 29, 2008 Author Share Posted February 29, 2008 i figured out its because i have TEXT in there Quote Link to comment https://forums.phpfreaks.com/topic/93753-mysql-automatically-changing-varchar-to-char/#findComment-480504 Share on other sites More sharing options...
fenway Posted March 1, 2008 Share Posted March 1, 2008 Yeah, my bad, I should have said all variable-length fields. Quote Link to comment https://forums.phpfreaks.com/topic/93753-mysql-automatically-changing-varchar-to-char/#findComment-480918 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.