Forum Discussion
Varchar(MAX) in SQL Endpoint
- 18 days ago
Hi fabanalytics ,
Nice find. If you need this on an existing Lakehouse without moving data, one option is to create the new Lakehouse with the setting enabled and then add shortcuts in its Tables section pointing at the tables in your old Lakehouse. The data stays where it is, but the new SQL endpoint picks them up through the new metadata sync. Worth testing whether VARCHAR(MAX) comes through on shortcut tables the same way.
To confirm what each endpoint is actually exposing, this quick query on both makes the comparison easy.
SELECT t.name AS table_name, c.name AS column_name, ty.name AS data_type, c.max_length FROM sys.columns c JOIN sys.tables t ON c.object_id = t.object_id JOIN sys.types ty ON c.user_type_id = ty.user_type_id WHERE ty.name LIKE '%char%' ORDER BY t.name, c.name;A max_length of -1 means VARCHAR(MAX). Since the new sync is still in preview, I'd keep the old Lakehouse around and only point production reports at the new one once you're happy it behaves.
Yes, this is expected behavior. Enabling New Metadata Sync only applies to endpoints created after the setting is enabled. Existing endpoints continue using the old sync engine, so there isn't currently a way to switch an existing one over.
That's also why you're seeing VARCHAR(MAX) work with the newly created Lakehouse but not the existing one.
For now, recreating the Lakehouse is the practical option. If the existing Lakehouse already has data, I wouldn't try to change it in place. I would create the new Lakehouse with the setting enabled first and then move or reference the existing Delta tables as appropriate.
Microsoft has mentioned an upgrade path for existing endpoints, but I would check the current roadmap/documentation before depending on that.