What does varchar(-1) mean?

Sreejith S T picture Sreejith S T · Nov 11, 2009 · Viewed 30.5k times · Source

What is the meaning of varchar(-1) in SQL Server 2008? Is it an alternative for varchar(max)?

Answer

gbn picture gbn · Nov 11, 2009

It's how to represent varchar(max) in .net SQLDBType (not explicitly stated, but length is -1)

I can't try it in SQL language in SQL Server right now for interest's sake: but I'm sure it's only for client code because varchar is normally strongly defined between 1 and 8000, but for max type it's not.