Repository: tobymao/sqlglot

Issue:
TSQL: ALTER COLUMN includes erroneous commands in transpiled statement
I got strange errors when using `ALTER COLUMN` in SQLMesh to change collation. After some testing it seems that the transpiler inserts `SET DATA TYPE` in the statement for the tsql dialect, which I interpret from the documentation to be wrong.

**Fully reproducible code snippet**
```
>>> from sqlglot import transpile
>>> transpile("ALTER TABLE a ALTER COLUMN b INTEGER", write="tsql")
['ALTER TABLE a ALTER COLUMN b SET DATA TYPE INTEGER]
```
Expected output:
`'ALTER TABLE a ALTER COLUMN b INTEGER'`

**Official Documentation**
[SQL Server documentation, `ALTER TABLE`](https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-table-transact-sql?view=sql-server-ver16)

Discussion:

Solution patch:
diff --git a/sqlglot/dialects/tsql.py b/sqlglot/dialects/tsql.py
index e9cfa2bbf9..934ade0653 100644
--- a/sqlglot/dialects/tsql.py
+++ b/sqlglot/dialects/tsql.py
@@ -910,6 +910,7 @@ class Generator(generator.Generator):
         COPY_PARAMS_EQ_REQUIRED = True
         PARSE_JSON_NAME = None
         EXCEPT_INTERSECT_SUPPORT_ALL_CLAUSE = False
+        ALTER_SET_TYPE = ""
 
         EXPRESSIONS_WITHOUT_NESTED_CTES = {
             exp.Create,
diff --git a/sqlglot/generator.py b/sqlglot/generator.py
index cccb92ae16..5b46a11c65 100644
--- a/sqlglot/generator.py
+++ b/sqlglot/generator.py
@@ -3346,7 +3346,8 @@ def altercolumn_sql(self, expression: exp.AlterColumn) -> str:
             collate = f" COLLATE {collate}" if collate else ""
             using = self.sql(expression, "using")
             using = f" USING {using}" if using else ""
-            return f"ALTER COLUMN {this} {self.ALTER_SET_TYPE} {dtype}{collate}{using}"
+            alter_set_type = self.ALTER_SET_TYPE + " " if self.ALTER_SET_TYPE else ""
+            return f"ALTER COLUMN {this} {alter_set_type}{dtype}{collate}{using}"
 
         default = self.sql(expression, "default")
         if default:


Test patch:
diff --git a/tests/dialects/test_tsql.py b/tests/dialects/test_tsql.py
index e2eda73a65..99591f00da 100644
--- a/tests/dialects/test_tsql.py
+++ b/tests/dialects/test_tsql.py
@@ -1062,6 +1062,16 @@ def test_ddl(self):
                 "tsql": "ALTER TABLE a ADD b INTEGER, c INTEGER",
             },
         )
+        self.validate_all(
+            "ALTER TABLE a ALTER COLUMN b INTEGER",
+            read={
+                "": "ALTER TABLE a ALTER COLUMN b INT",
+            },
+            write={
+                "": "ALTER TABLE a ALTER COLUMN b SET DATA TYPE INT",
+                "tsql": "ALTER TABLE a ALTER COLUMN b INTEGER",
+            },
+        )
         self.validate_all(
             "CREATE TABLE #mytemp (a INTEGER, b CHAR(2), c TIME(4), d FLOAT(24))",
             write={