SQL Server Text Datatype Maxlength = 65,535?

前端 未结 5 1821
忘掉有多难
忘掉有多难 2020-12-10 16:32

Software I\'m working with uses a text field to store XML. From my searches online, the text datatype is supposed to hold 2^31 - 1 characters. Currently SQL Server is trunca

5条回答
  •  余生分开走
    2020-12-10 16:42

    that is a limitation of SSMS not of the text field, but you should use varchar(max) since text is deprecated

    alt text

    Here is also a quick test

    create table TestLen (bla text)
    
    insert TestLen values (replicate(convert(varchar(max),'a'), 100000))
    
    select datalength(bla)
    from TestLen
    

    Returns 100000 for me

提交回复
热议问题