Sample Header Ad - 728x90

"The data type of a column of a partitioned table can't be changed."

4 votes
1 answer
104 views
[The documentation claims](https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-table-transact-sql?view=sql-server-ver17#alter-column) > The data type of a column of a partitioned table can't be changed. It repeats this claim elsewhere [such as here](https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-table-transact-sql?view=sql-server-ver17#partitioned-tables) . Yet I have never seen this fail.
CREATE PARTITION FUNCTION pf(int)
AS RANGE RIGHT FOR VALUES(10, 20, 30)
GO

CREATE PARTITION SCHEME ps
AS PARTITION pf
ALL TO ([primary]);
GO

CREATE TABLE Part
(
    id INT IDENTITY PRIMARY KEY CLUSTERED,
    name VARCHAR(50)
) ON ps(id);
GO

INSERT INTO Part (name)
SELECT TOP(40) CONVERT(VARCHAR(50), [text])
FROM sys.messages;
GO

ALTER TABLE Part
ALTER COLUMN [name]
SQL_VARIANT;
GO
So what am I missing?
Asked by J. Mini (1237 rep)
May 29, 2025, 03:29 PM
Last activity: May 29, 2025, 07:17 PM