views:

1489

answers:

3

What SqlDbType maps to varChar(max)? SqlDbType.VarChar says that it is limited to 8K, though that may be a documentation error.

A: 

Use SqlDbType.Text.

VARCHAR(MAX) is actually improved TEXT from older versions of MS SQL. It differs from VARCHAR significantly.

Quassnoi
+1  A: 

Actually you can use it with VarChar. If it is a parameter you can build it with: new SqlParameter("@myparam", SqlDbType.NVarChar, -1)

See: http://msdn.microsoft.com/en-us/library/bb399384.aspx

eglasius
Do I have to pass a size of -1 or can I just leave it blank?
Jonathan Allen
A: 

Use VarChar, and set size to 2147483647 (2gb-1)

Frans Bouma