Questions tagged [varcharmax]

The maximum count of type varchar

The maximum count of type varchar. A varchar or Variable Character Field is a set of character data of indeterminate length. The term varchar refers to a data of a field (or column) in a database management system. Varchar fields can be of any size up to a limit, which varies by databases: an Oracle 9i database has a limit of 4000 bytes, a MySQL database has a limit of 65,535 bytes (for the entire row) and Microsoft SQL Server 2005 has a limit of 8000 bytes (unless varchar(max) is used, which has a maximum storage capacity of 2 gigabytes).

71 questions
92
votes
9 answers

Why not use varchar(max)?

I'm a bit old school when it comes to database design, so I'm totally for using the correct data sizes in columns. However, when reviewing a database for a friend, I noticed he used varchar(max) a lot. Now, my immediate thought was to throw it back…
AtaLoss
  • 973
  • 1
  • 7
  • 5
13
votes
3 answers

SQL server Varchar(max) and space taken

If varchar(max) is used as the datatype and the inserted data is less than the full allocation, i.e. only 200 chars, then will SQL Server always take the full space of varchar(max) or just the 200 chars' space? Further, what are the other data types…
aads
  • 2,255
  • 4
  • 24
  • 25
11
votes
3 answers

SQL Server field getting truncated

Ok I'm using SQL Server 2008 and have a table field of type VARCHAR(MAX). Problem is that when saving information using Hibernate, the contents of VARCHAR(MAX) field is getting truncated. I don't see any error messages on either the app server or…
Marquinio
  • 4,601
  • 13
  • 45
  • 68
8
votes
3 answers

SQL 2008 - varchar(max) vs text data types

Possible Duplicate: SQL Server Text type vs. varchar data type Using varchar(MAX) vs TEXT on SQL Server from this article, it looks like they both have the same size capacity: http://msdn.microsoft.com/en-us/library/ms143432.aspx is that truly…
Madam Zu Zu
  • 6,437
  • 19
  • 83
  • 129
6
votes
2 answers

Varchar(Max) is not working in Exec

I have a variable which has SQL string stored in it and am executing it through exec() Declare @sql varchar(max) set @sql = Concat('select...',@var,'..') -- large string exec (@sql) but am getting error saying Incorrect syntax near…
Pரதீப்
  • 91,748
  • 19
  • 131
  • 172
5
votes
1 answer

LINQ Large string (64k) not inserted into SQL Database

I have a column in SQL varchar(max). Using LINQ, when I'm trying to add a record with a string over 64k large, the value is not saved into DB. I'm simply doing; test.MyString = LargeString; //(over 64k…
Red Taz
  • 51
  • 3
5
votes
1 answer

Ruby 2.0 on windows connecting to MS SQL varchar(max) truncating to 2048

background: i have written a few ruby transformation scripts they get data from MS SQL transform them and then store it back to the data base i am using tiny tds gem which works over freetds --Problem: for columns in sql that are varchar max and…
Ahmed
  • 1,985
  • 1
  • 13
  • 8
4
votes
4 answers

SQL Server 2008 VarChar(Max) returns only 8000 Characters. Why?

PRINT Convert(VarChar(Max),Replicate('1234567890 ',1000)) This returns to the window 7,997 characters. SELECT Convert(VarChar(Max),Replicate('1234567890 ',1000)) This returns to the grid 7,996 characters. The extra character in the print window is…
Gregory Hart
  • 137
  • 1
  • 7
4
votes
4 answers

My VARCHAR(MAX) field is capping itself at 4000; what gives?

I have a table in one of my databases which is a queue of emails. Emails to certain addresses get accumulated into one email, which is done by a sproc. In the sproc, I have a table variable which I use to build the accumulated bodies of the emails,…
eidylon
  • 7,068
  • 20
  • 75
  • 118
3
votes
3 answers

Concatenate varchar(max) variables SQL Server 2005

Just ran into a major headache when concatenating several @varchar(max) variables together to build an email based on several different queries. For efficiencies sake, I was using several varchars to build the email at once, rather than going…
Dakine83
  • 687
  • 2
  • 9
  • 23
3
votes
1 answer

Returning varchar(max) Output parameter from stored procedure truncating to 4000 characters

I've got a classic ASP appln with a SQL2012 database. I recently changed a table column from varchar(8000) to varchar(max) as it wasn't big enough to store the required data. I can update the column with all of the data I need to store, but the SP…
Mike
  • 105
  • 3
  • 10
2
votes
1 answer

Sql Server Varchar(max) and Text Data Types

I am researching varchar(max) data type in sql server and I try to compare with text and varchar(8000) datatype. I read several articles about this. As specified in some articles, we cannot update text column using regular DML statements and…
Umut Derbentoğlu
  • 1,146
  • 5
  • 18
  • 39
2
votes
2 answers

SSIS Script Component DT_TEXT newline not correctly stored in table

I need to store a large text created in the SSIS package Data Flow Script Component to the destination column with data type varchar(max). I use therefore as an Output Column text stream [DT_TEXT]. Inside the C# script I call the method…
iStan
  • 78
  • 1
  • 11
2
votes
2 answers

Hibernate schema validation | MS SQL varchar(max) | MS SQL 2008

Having problems with JPA/Hibernate and an existing MS-SQL 2008 database, which has a table with a column defined as "varchar(max)". MS Docs about varchar(n|max) and additional Stack thread - see the answer Column definition copied from MS SQL 2008…
Jens Fuchs
  • 65
  • 1
  • 9
2
votes
2 answers

SSMS and sp_OAMethod: is there a Data Type greater than VARCHAR(8000)?

Calling a REST service through SSMS is indeed not a great idea. BTW since Microsoft created the Stored Procedure sp_OAMethod and even Phil Factor from Red Gate show us how to use it I wanted to give it a go. I wanted to import some data from…
Francesco Mantovani
  • 10,216
  • 13
  • 73
  • 113
1
2 3 4 5