Is it possible to edit a partition function on MSSQL 2016? I've inherited a partitioned database with millions of rows and I've noticed there is a typo in the partition function:
CREATE PARTITION FUNCTION [Partition_by_customer](varchar(10)) AS RANGE RIGHT FOR VALUES (N'DMA', N'DMB', N'DMC', N'DMD', N'DME')

Is there an easy way to remove those unicode converters (as they are causing implicit conversions), everything should be a varchar(10)
Thanks
Roger
The implicit conversion of the Unicode literal to varchar is a one-time operation done when the DDL is executed. The &quot;typo&quot; ('N' national character prefix) is not part of the partition function definition nor used by SQL Server after creation. The Unicode literal is generated by SMO when the function definition scripted.
The actual boundary values are a SQL_VARIANT type and match the partition function data type definition regardless of the specified literal. The catalog view query below shows this:
SELECT
      prv.value AS BoundaryValue
    , SQL_VARIANT_PROPERTY(value, 'BaseType') AS DataType
    , SQL_VARIANT_PROPERTY(value, 'MaxLength') AS Length
FROM sys.partition_functions AS pf
JOIN sys.partition_range_values AS prv ON prv.function_id = pf.function_id
WHERE pf.name = N'Partition_by_customer';

Results:
+---------------+----------+--------+
| BoundaryValue | DataType | Length |
+---------------+----------+--------+
| DMA           | varchar  |     10 |
| DMB           | varchar  |     10 |
| DMC           | varchar  |     10 |
| DMD           | varchar  |     10 |
| DME           | varchar  |     10 |
+---------------+----------+--------+