large database used size
2 TopicsWhy is SQL Server only storing 4000 characters in an NVARCHAR(MAX) column?
Hi Guys, I'm trying to insert a string with 10,000 plain characters (just repeated 'A's) into a column defined as NVARCHAR(MAX) in SQL Server. But LEN(Content) always returns 4000, not 10,000. I’ve verified that the column is NVARCHAR(MAX) and used the N prefix for Unicode. Still, the data seems to be truncated. What could be causing this? Is there something I'm missing in how SQL Server handles large strings? Tried this: CREATE TABLE LargeTextExample ( Id INT PRIMARY KEY IDENTITY(1,1), Content NVARCHAR(MAX) ); DECLARE @LongText NVARCHAR(MAX); SET @LongText = REPLICATE(N'A', 10000); INSERT INTO LargeTextExample (Content) VALUES (@LongText); SELECT LEN(Content) AS CharacterCount FROM LargeTextExample; Thanks, TusharSolved45Views0likes1CommentAzure SQL Database or SQL Managed Instance Database used data space is much larger than expected
In this article we consider the scenario where the used size of an Azure SQL Database or SQL Managed Instance Database is much larger than expected when compared with the actual number of records in the tables and how to resolve it.12KViews8likes0Comments