sql server - Text overflow when using nvarchar(max)? -


i've run strange situation seems involve long text overflowing. i'm using fn_pcre_replace (from xp_pcre extended stored procedure) on nvarchar(max) column, , when replace more characters there originally, returns null if original string on 8000 characters long.

for example,

select master.dbo.fn_pcre_replace(overview,'a', 'x') projectcontent  

works expected, this

select master.dbo.fn_pcre_replace(overview,'a', 'xxx') projectcontent  

returns null in cases (apparently, wherever len(overview)>8000).

is limitation of xp_pcre, or there can in sql make work?

this limitation of xp_pcre. looking @ source:

    switch (btype)     {     case srvbigchar:     case srvbigvarchar:         break;     default:         throw xpexception(             stringbuilder()             << "invalid data type on parameter "             << paramnum             << " (should char or varchar)."             );     } 

i can conclude these 2 values (from <srv.h>) permit maximum of 8000 characters. srvbigvarchar is

variable-length character data type, length 0 8000 bytes.

you need update source , recompile support srvtext or srvvarchar not limiting factor when using external procedures.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -