0

I recently discovered that MS-SQL Server 2008 imposes an upper limit of 8000 bytes for a column (for character data).
I need to store data that occusionally could surpass this limit.
Is there a way to do this?
The data are character strings.

Thanks

user76678
  • 349
  • 3
  • 5
  • 16

1 Answers1

2

Use varchar(max) or nvarchar(max). These have a storage limit of 2^31-1 bytes.

squillman
  • 37,883
  • 12
  • 92
  • 146
  • @squillman:But here http://msdn.microsoft.com/en-us/library/ms143432.aspx does not make such a distinction. – user76678 May 23 '11 at 19:58
  • 1
    @user76678 Yes it does. On that page see the lines that say **Bytes per varchar(max), varbinary(max), xml, text, or image column** and **Characters per ntext or nvarchar(max) column** under Database Engine objects. – squillman May 23 '11 at 20:03
  • @squillman:May be it is my missunderstanding;what is the difference with `Bytes per short string column`? – user76678 May 23 '11 at 20:04
  • @user76678 Also, are you using SQL Server 2008 or SQL Server 2008 R2? Whereas this particular item is not different between the two, they are different versions. – squillman May 23 '11 at 20:05
  • @user76678 **Bytes per short string** is for the non `max` flavor of varchar and nvarchar. That is, (n)varchar can go up to 8000 characters (ie- varchar(8000) / nvarchar(8000)) When you use (n)varchar(max) that changes the game. – squillman May 23 '11 at 20:12
  • @squillam:Mainly R2. – user76678 May 23 '11 at 20:14