What does varchar(-1) mean?

前端 未结 5 2010
故里飘歌
故里飘歌 2020-12-06 04:30

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

相关标签:
5条回答
  • 2020-12-06 04:51

    It is only SQL Query Analyser which displays -1 instead of Max. In design view, still you can see it as Max.

    0 讨论(0)
  • i think it is varchar(max). I never seen it before.

    0 讨论(0)
  • 2020-12-06 05:02

    The documentation says:

    varchar [ ( n | max ) ] Variable-length, non-Unicode character data. n can be a value from 1 through 8,000. max indicates that the maximum storage size is 2^31-1 bytes.

    So -1 isn't technically valid. It might work, but I wouldn't use it if I were you.

    0 讨论(0)
  • 2020-12-06 05:05

    Yes man... it´s a varchar(MAX)

    0 讨论(0)
  • 2020-12-06 05:09

    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.

    0 讨论(0)
提交回复
热议问题