0

I was simply wondering if there was a performance or other technical reason for you to be unable to perform a ALTER TABLE ALTER COLUMN statement with multiple columns within the same line e.g.

ALTER TABLE tblGeneric ALTER COLUMN Generic1 VARCHAR(255), Generic2 VARCHAR(255);

This is exclusively a restriction of t-sql as you can in fact comma separate columns with the MODIFY statement of mysql.

I just thought it odd, especially considering the MODIFY of mysql, that you can do a same line multi ALTER TABLE ADD statement but not a same line multi ALTER. I was just wondered if there is any particular documented reason for this or at least if it's in a issues list.

Edward G-Jones
  • 575
  • 3
  • 11
  • 24
  • Possible duplicate of [How to ALTER multiple columns at once in SQL Server](https://stackoverflow.com/questions/3465560/how-to-alter-multiple-columns-at-once-in-sql-server) – T.S. Nov 29 '18 at 16:36

1 Answers1

0

SQL Server T-SQL doesn't allow multiple columns to be changed in one ALTER TABLE command (unlike some other languages where it's possible).

Please follow this MSDN link for ALTER command syntax and explanation.

However, you can do multiple ADD or multiple DROP COLUMN, but just one ALTER COLUMN.

Sathish
  • 1,936
  • 4
  • 28
  • 38