0

Is it possible to change the nullable attribute of a column without specifying its data type? For example in the following statement I do not want to change the data-type yet I have to specify it.

DB::statement('ALTER TABLE `throttle` MODIFY `user_id` INTEGER UNSIGNED NULL;');

I mean in any RDBMS in particular MySQL.

Handsome Nerd
  • 17,114
  • 22
  • 95
  • 173
  • 1
    That depends on the DBMS. Generally speaking, the ISO SQL specifications do not not standardise `ALTER` statements. However in all of the systems I've used you always need to provide a full column type definition. – Dai Aug 11 '17 at 00:36
  • 1
    You may be pertaining to an Oracle's alter table mytable modify(mycolumn null); or ALTER TABLE mytable ALTER COLUMN mycolumn DROP NOT NULL; But for MySQL, you have to indicate the data type. – Ferdinand Gaspar Aug 11 '17 at 00:41
  • Possible duplicate of [How do I modify a MySQL column to allow NULL?](https://stackoverflow.com/questions/212939/how-do-i-modify-a-mysql-column-to-allow-null) – philipxy Oct 11 '17 at 19:49
  • What did googling tell you? – philipxy Oct 11 '17 at 19:49
  • @philipxy You may wonder but I love your comment. So funny. – Handsome Nerd Oct 12 '17 at 00:26
  • @FerdinandGaspar Thanks for your comments.Good to see at least one database provides such feature – Handsome Nerd Oct 12 '17 at 05:06

0 Answers0