varchar

Will extending the size of a varchar field in MySQL affect the data thats inside it?

I am going to be extending the column from VARCHAR(350) to VARCHAR(800) - will affect any of the strings that are inside the column already? ...

How to get MAX value of a version-number (varchar) column in T-SQL

I have a table defined like this: Column: Version Message Type: varchar(20) varchar(100) ---------------------------------- Row 1: 2.2.6 Message 1 Row 2: 2.2.7 Message 2 Row 3: 2.2.12 Message 3 Row 4: 2.3.9 Message 4 Row 5: 2.3.15 Message 5 I want to write a T-Sql query that will get ...

BLOB vs. VARCHAR for storing arrays in a MySQL table

I've got a design decision to make and am looking for some best practice advice. I have a java program which needs to store a large number (few hundred a day) of floating point arrays in a MySQL database. The data is a fixed length Double array of length 300. I can see three reasonable options: Store the data as a BLOB. Serialize th...

Why does VARCHAR need length specification?

Why do we always need to specify VARCHAR(length) instead of just VARCHAR? It is dynamic anyway. UPD: I'm puzzled specifically by the fact that it is mandatory (e.g. in MySQL). ...

mysql Char vs varchar

I know the differnce between CHAR and VARCHAR, CHAR - Fixed length VARCHAR - Variable length (size + 1 byte) But I wanted to know what was the purpse of the having the option for a varchar length e.g. VARCHAR(50), VARCHAR(100), VARCHAR(255) This seems pointless to me because the actual space used depends on the value stored i...

Regarding the ArgumentException in sql database

I am developing a ASP.net website using VS 2008. There is a table where a file name is inserted. The data type of the table attribute is Varchar(Max). But still ArgumentException is thrown for less than 50 character file names. Is there any other reason for this to happen? Thanks in advance. ...

SQLite - Is it possible to make a non-integer Primary Key work?

Thanks for reading and hopefully answering, Due to legacy issues and company policy, I am working with SQLite 2.8.17 and have a few varchars as primary keys. But when I run a *"pragma integrity_check"*, it reports "rowid missing from index" and "wrong # of entries in index" on the tables with the varchar primary key but the returned re...

Does anyone have considerable proof that CHAR is faster than VARCHAR ?

Any benchmark, graph anything at all ? Its all academic and theoretical across the web. Ok its not the first time that this question has been asked, they all say that using CHAR results in faster selects? I even read in MySQL books, its all the same but I have not come across any benchmark that proves this. Can any one shed some light...

How does this not make varchar2 inefficient?

Suppose I have a table with a column name varchar(20), and I store a row with name = "abcdef". INSERT INTO tab(id, name) values(12, 'abcdef'); How is the memory allocation for name done in this case? There are two ways I can think of: a) 20 bytes is allocated but only 6 used. In this case varchar2 does not have any significant adva...

Appropriate SQL type for variable length url's and descriptions?

I have a small db app that stores URL's of all lengths, some extremely long (hundreds of characters) and some of typical length (< 50 characters). Am I introducing inefficiencies into the DB by declaring VARCHAR(1000) (or higher) as the type? Is there something better to use? ...

Is "VARCHAR(255) CHARACTER SET utf8" 255 bytes or 255 characters.

I've declared a field in my INNODB/MySQL table as VARCHAR(255) CHARACTER SET utf8 NOT NULL however when inserting my data is truncated at 255 bytes not characters. This might chop the trailing two bite code point i*emphasized text*n two leaving an invalid character. Any ideas what I might be doing wrong EDIT: A sample session is l...

hw to use richtext box for maintain text formating?

I am creating such application where user can post there articles upto 800-1000 words . What should I use to maintain text formating like paragraph, next line etc.(if i use textarea as input textbox for article?). I am using mySql so what shod my datatype to store article text VARCHAR or TEXT?? and what shoud be the size for 1000 words? ...

what is the diff between TEXT and VARCHAR datafields?

I have following confusions - 1. Which datatype is used for bigger amount of data store 2. When we specify varcha(100) so this 100 represent 100 characters or 100 bits or bytes ...

ADO.NET + Sql Server Varchar encoding problem

Put simply, I have a set of special characters in a Sql Server database varchar column, and I want to fetch it from a C# application. Now the difficulty is: using Query Analyzer, I get the desired value of: "·°ï££". However, through the client application, I end up with: "À░´úú". It's a varchar column in a database with collation SQL_...

Index for a VARCHAR field with a 384 length in a MySQL database

I have a varchar(384) to store emails in a MyISAM table and I want check when the email exists but the index length limit is 333 bytes (because I'm using utf8 (1000 bytes/3 bytes)). Then what's the best way to search if a specified email exists, using a FULLTEXT index or creating another field with the email md5-hash in a BINARY(16) (wi...

Varchar for UTF-8 ?

Hi, I found a similar post about this but still not sure. As i am making my guestbook and so forth multilanguage i changed the collation to uft8_unicode_ci in mysql, everything works as it should, something that i did not think of was the type i use, my guestbook is multilanguage and for the name field a user cannot enter more than 50 ...

I'm acquiring a VARCHAR variable through php, and want to show it using HTML/CSS. How do I auto format it so that it isn't one long sentence.

I basically want to automatically add line breaks to a VARCHAR variable I acquire from a mysql database trough PHP, so that it shows right. At the moment when I show it trough HTML, all it does is give me a long sentence. I imagine this can be done with CSS, but overflow: scroll just makes it scroll to the right and left. Use of javascr...

Which charsets does varchar support? ie UTF-8

Google failed to give a definiative answer. So here goes Mr Stackoverflow... Which charsets does varchar support in MSSQL? i.e. ASCIII, UTF-8 etc... ...

T-SQL: How to obtain the the exact length of a string in characters?

I'm generating T-SQL SELECT statements for tables for which I have no data type information up-front. In these statements, I need to perform string manipulation operations that depend on the length of the original value of the tables' columns. One example (but not the only one) is to insert some text at a specific position in a string, ...

varchar(max) + linq to sql

I've got a varchar(max) column I'm trying to read but the field is being truncated at 4,000 characters. I've seen similar questions, but they are on the sql side. What do I need to do to get the entire field? Eg: using (DataContext dc = new DataContext()) { var foo = dc.foos.First(); if (foo.Formula2.Length > 4000) { ...