SQL Server: incorrect ALTER COLUMN statement generated from Heidi
Preconditions
- HeidiSQL version: 12.1.0.6566
- Database type and version: MS SQL Server 11.0
- OS: Windows
Describe the bug
HeidiSQL is wonderful application for managing SQL databases, it is perfect by my opinion when dealing with MySQL, however it has incorrect SQL statement generation when dealing with MSSQL Server, the ALTER TABLE / ALTER COLUMN statement sets the column name twice (instead of only 1 time), which produces of course SQL "Incorrect syntax" error.
To Reproduce
Example:
- The statement generated for altering the table column from HeidiSQL is:
ALTER TABLE "dbo"."SomeTable" ALTER COLUMN "SomeColumn" "SomeColumn" VARCHAR(50) NOT NULL COLLATE 'Cyrillic_General_CI_AS'; - It should be:
ALTER TABLE "dbo"."SomeTable" ALTER COLUMN "SomeColumn" VARCHAR(50) COLLATE Cyrillic_General_CI_AS NOT NULL; - Also, note that the collation part is also invalid (it must be set without single quotes), which again produces SQL "Incorrect syntax" error.
- The
NOT NULLstatement should be the last also. - The above problems occur every time you create/modify MSSQL table (in fact you cannot modify MSSQL table via HeidiSQL interface, instead you have to copy the statements generated from the log file, correct them manually and run them in SQL editor), so I believe that fixing them will benefit greatly the community.
Screenshots or Crash reports
Any update on this? Getting all sorts of errors when using HeidiSQL with a MSSQL database.. Do I need to change any settings?
It's indeed a quirk in HeidiSQL's automatic query generation with MS SQL Server databases.