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
1
vote
0 answers

SQL Datatype Varchar(max) Vs Varchar(8000)

What I understand: If I define a column with Varchar(100) and then store only 40 bytes then SQL will allot only 40 bytes for that cell. What I want to know: Now, if I define all my cells as Varchar(8000) then what is the problem? Why should I even…
Alok Singh
  • 174
  • 3
  • 15
1
vote
1 answer

Efficiency of varchar(max) in T-SQL code

I have a question about the "efficiency" (speed, memory usage) of (n)varchar(max) versus (n)varchar() in T-SQL code (stored procedures, functions). I am not asking about its usage in column definitions. In existing code, I am…
JonBrave
  • 4,045
  • 3
  • 38
  • 115
1
vote
1 answer

What special character is better for text search?

I am using Sql Server 2014 Express and have a varchar(max) column. I some cases I need to use an special character to give special meaning to this field. I have for example this value: "123.456.234", but I would like to use something like that:…
Álvaro García
  • 18,114
  • 30
  • 102
  • 193
1
vote
1 answer

SSIS - varchar(max)

I have sp which concatenate a long string and which passes back to SSIS. but currently SSIS is only picking the string partially. Is there a method which allows the a T-SQL stored procedure to pass a long string to SSIS ? Currently the parameter is…
1
vote
1 answer

Separating varchar(max) string into a list in sql server

I have data saved as 1¬2¬4¬5¬7 and I want to split them to first response = 1, second response = 2, third response = 4, forth response = 5 and fifth response = 7. They are in the column as varchar(max) and need to report on these. Is there a way to…
1
vote
3 answers

Is it possible to have a varchar(max) column for an ActiveRecord object type?

I really want to have a column of inifinite length for one of the properties of my ActiveRecord object of type string, but I don't know how to set it. When I set the length to -1 (the number for MAX in SQL server) I get an error. Can anyone…
skb
  • 30,624
  • 33
  • 94
  • 146
1
vote
1 answer

String or Binary Data Would Be Truncated on varchar(max)

I've checked around and everyone seems to be running into issues with column lengths being too small. I don't think that's my issue as everything is a varchar max. I have a large text string being stored in a column Select len(templateDocument)…
Jabsy
  • 171
  • 4
  • 16
1
vote
3 answers

Retrieving VarChar(MAX) from SQL Server using C# and a stored procedure

I have a WebMethod which is called to retrieve a varchar(max) column from SQL Server. I create my neccessary stored procedure, which works fine in Management Studio, but when I run the below code I get an error: Invalid attempt to read when no data…
CSharpNewBee
  • 1,951
  • 6
  • 28
  • 64
0
votes
1 answer

What is sql Type -10 (relating it Sql Server's nvarchar(max))

I've been investigating issues with jtds' mis-reporting of sql server's varchar(max) and nvarchar(max) column types (which are the recommended replacement of text and ntext). Between the inet, jtds, ms jdbc database drivers, the only consistent…
Stephen
  • 19,488
  • 10
  • 62
  • 83
0
votes
0 answers

T-SQL variable of type nvarchar(MAX) does not accept data in full

So there is such a code: DECLARE @DocJSONGoods nvarchar(MAX) SELECT @DocJSONGoods = ( SELECT ProductsItems, DocCDProductsChapterNumber, DocCDProductsNomenclatureData, DocCDProductsPurchase, …
geenSf
  • 1
0
votes
0 answers

How to compare SQL Query XML Varchar(max)?

How can I use less than or equal to comparison in this xml varchar(max) element? select * from table where SHARED_XML.value('(//ns:Element[@ns:ElementId="29581"]/ns:ElementValue/text())[1]', 'varchar(max)') < '10'
0
votes
0 answers

does using cast(col as VARCHAR(MAX)) even if the column didn't have large data affect performance in SQL server?

I found that if a column data type is set as varchar(max) in a table will affect the performance by the following large space will be occupied indexing is not possible But does it affect, when I use a query like Cast(column name as varchar(max))…
0
votes
1 answer

How to overcome limitation of Snowflake Varchar (16,777,216) to load image data

We have a scenario to load Image column from SQL Server which is our source and load into Snowflake, but its failing due to "String Long Issue" as Snowflake has Varchar Limitations. Till now, we have tried Varchar and Variant datatypes as well to…
0
votes
1 answer

How to handle varchar(max) in t4 script?

I'm using .tt scripting in VS 2017(SSDT 2017) in the DB project. We create staging tables structures manually and then the T4 script generates final destination tables based on the staging table structure. I have this code to get columns and their…
LeoG
  • 23
  • 4
0
votes
1 answer

MSSQL varchar(max) 50 seconds for one record to insert

Hi i have a table with field i need to store a text/json/xml into. If i insert just one record with a length of about 20MByte it takes forever about 50 seconds. The table is defined like this table { ID: integer autoincrement primaryindex Data:…
user2587790
  • 121
  • 1
  • 1
  • 8